Microsoft Store
 

Polish notation


 

Polish notation, also known as prefix notation, is a method of mathematical expression. It was created by Jan ?ukasiewicz, mostly to simplify certain mathematical proofs. Its distinguishing feature is that it places operators before operands.

Related Topics:
Jan ?ukasiewicz - Operator - Operand

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

For example, this expression:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

+ 1 2

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

evaluates to 3.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Polish notation is not limited to only two values, nor to just addition. For example, this expression:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

(× (+ 0 1) (+ 2 3))

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

evaluates to 5.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

While the examples above use parentheses, one of the benefits of Polish notation is that, assuming the arity of each operator is known, parentheses are unnecessary: the order of operations is unique and easy to determine, provided that the expression is well-formed. For example, assuming × and + are binary, then this expression:

Related Topics:
Arity - Order of operations

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

× + 0 1 + 2 3

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

can mean only this:

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

(× (+ 0 1) (+ 2 3))

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Polish notation is used in some computer programming languages, including Lisp and its dialect Scheme. It is also used in Tcl.

Related Topics:
Computer programming language - Lisp - Scheme - Tcl

~ ~ ~ ~ ~ ~ ~ ~ ~ ~