You are viewing the historical archive of The Philosophy Forum.
For current discussions, visit the live forum.
Go to live forum

Does Polish Notation have any advantage over Reverse Polish Notation?

Michael Ossipoff July 21, 2017 at 19:20 2250 views 4 comments

I'll call Polish Notation "FPN", for "Forward Polish Notation".

RPN has at least one useful advantage over RPN:

The operations are entered on a calculator or added to the notation as they come up in the evaluation of an expression.

...whereas, with FPN, it's necessary to initially enter the all the operations, in reverse order of their occurrence among the operands.

(...as encountered in expression-evaluation. ...e.g. from left to right, numerators before denominators)

But does FPN have any advantage over RPN?

Michael Ossipoff

Comments (4)

Michael Ossipoff July 21, 2017 at 19:21 #89000
Typo correction:

In the 2nd sentence of my post, I meant to say:

RPN has at least one useful advantage over FPN.

Michael Ossipoff

noAxioms July 21, 2017 at 20:48 #89015
Either one requires a stack, but an operation consumes less space than a number, so the FPN stack takes fewer resources to implement the worst case stack.

I could be wrong about this.
noAxioms July 21, 2017 at 20:56 #89020
That's a weak advantage. It takes more instructions (calculator key presses) to code with FPN.
RPN 3,15+ (where comma is )
FPN +3,15, <-- extra comma
Michael Ossipoff July 22, 2017 at 15:24 #89227
Reply to noAxioms

Thanks for pointing out the possible worst-case-memory-use advantage of FPN.

Maybe in the earlier days of computers, such an advantage could have been crucial.

And thanks also for pointing out the fewer-instructions/keypresses advantage of RPN.

I hadn't looked at it closely enough to notice that.

It adds to RPN's other advantage--the convenience of entering each operation as it's encountered among the operands.(Instead of first initially going through and entering all the operations in reverse order of occurrence among the operands).

Thanks again for pointing those things out.

Michael Ossipoff