Liam Clarke said unto the world upon 2004-12-05 00:31:
RPN calculator, with operators and operands separate? Sounds
counter-intuitive to me.
What's the advantage I'm missing?

P.S.

Hi Liam and all,

Is RPN really written with operators and operands separate? If so, that is a bit odd. The name, so far as I know, comes from a notation developed in Poland in the 1920's (+/- 5 years) for writing logical formula without brackets. But it does not quite separate out the two classes of symbols.

Writing 'v' for or and '&' for and,

A v ((B & C) v D)

would go over as:

vAv&BCD

and

(A v B) & (C v D)

as

&vABvCD

The advantage is 1) everything can be unambiguously written without '(' characters, and thus, 2) parsing code is a bit easier to write.

By analogy, I had always assumed that Polish Arithmetic would read

(2 + 3) - 1 and
2 + (3 - 1)

as:

-+231 and
+2-31

I further assumed that RPN would simply reverse this. If that isn't true, I think I need to go investigate the origins of the name.

Best to all,

Brian vdB

_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to