tlhIngan-Hol Archive: Wed Oct 11 15:23:57 2000
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: PN & RPN
On Sun, 1 Oct 2000 [email protected] wrote:
> > Polish notation is when you put the
> > operator before the operands, e.g. for 1 + 2, write + 1 2.
> > So, for multiple additions, you'd write + + 1 2 3. This
> > is naturally (1 + 2) + 3.
> >
> > But for reverse Polish notation, you write the operands
> > first and the operator last. e.g. for 1 + 2, write 1 2 +.
> > To add 1 and 2 and 3, you'd do 1 2 3 + +. However, this
> > naturally enforces 1 + (2 + 3).
>
> These are both right, but incomplete.
> Polish Notation (or prefix notation) puts the function first, whereas
> Reversed Polish Notation (RPN or postfix notation) puts the function last.
> (The common order of 1 + 2 is also called infix notation.)
> Thus infix 1 + 2 would be + 1 2 in PN, just as it's given above, and in RPN
> it is 1 2 +.
> But 1 + 2 + 3 has two different forms in PN and two different forms in RPN:
> PN: + + 1 2 3 or + 1 + 2 3 and in
> RPN: 1 2 3 + + or 1 2 + 3 +.
> The differences are equivalent to the parentheses in infix notation.
>
> lay'tel SIvten
>
I see. My adding machine works on RPN with a default setting of 0. (i.e.,
[0] 1+ 2+ 3+...)
quljIb
P.S. Why do the Poles have such weird math notation?