Why is Postfix (rpn) notation more used than a prefix?

I mean its use in many calculators such as the HP35-

My hunch (and confusion) -

  • Postfix is ​​actually more memory efficient - (SO post comments here ). (confusion - the algorithm for evaluating both is similar to the stack)
  • the type of keyboard input in the calculators then (confusion - it should not have made much difference, since it depends only on the order of operators given from the first or last).

Another way this question can be asked is that the benefits of postfix notation have a prefix?
Can anyone enlighten me?

+4
source share
4

.

, , , , . , , , , .

, , , , .

, : - + 10 20 + 30 40 - + , , .

, , () , . , , .

+4

, , postfix, , Stack:

  • ,

  • , Stack,

  • Stack, , Stack.

  • , 1.

expression = 1 2 + 3 4 + *
stack = [  ]

Read 1, 1 is Operand, Push 1
[ 1 ]

Read 2, 2 is Operand, Push 2
[ 1 2 ]

Read +, + is Operation, Pop two Operands 1 2
Evaluate 1 + 2 = 3, Push 3
[ 3 ]

Read 3, 3 is Operand, Push 3
[ 3 3 ]

Read 4, 4 is Operand, Push 4
[ 3 3 4 ]

Read +, + is Operation, Pop two Operands 3 4
Evaluate 3 + 4 = 7, Push 7
[ 3 7 ]

Read *, * is Operation, Pop two Operands 3 7
Evaluate 3 * 7 = 21, Push 21
[ 21 ]
+2

, , ... , F (x, y). , , ( , ), , , .

, , , f(g(x)) , g , f. : x.f.g , f. , h "", x.f.g.h.

3d-, . XYZ. postfix vec.rotx(phi).roty(theta).rotz(psi). * (), , , rotz*roty*rotx*vec. , , .

, - rotx*roty*rotz*vec - , , ZYX. . , , .

, ( ) f(g(h(x))), f ( ), g, h, ok h x, g , f . x.f.g.h. - ( , ) . , , x.f.g.h . .

: f(g(h(x))) , Lisp. , .

( , ) , , , . -, , , .

+2

, , - .

, , (, , ,...). , , (, - . ).

, , " / ". , . ( / ), .

, ...

+1

All Articles