reverse Polish

deborah deborah.dwj at suberic.net
Tue Dec 21 23:44:45 EST 2004


On Tue, 21 Dec 2004 Devra at aol.com wrote:

|        All right, I'll bite.  What the h*ck is Reverse Polish Notation? Has
|it got anything to do with the fact that the numbers on the telephone aren't
|in the same pattern as the ones on the calculator? The ones on the credit card
|box I have now match the phone, but are opposite to the calculator...*sigh*

Nothing like the phone.  It's a calculator using the computer concept of
a stack -- postfix operators rather than infix.  That is, instead of
2+3*5, it would be "+ * 5 3 2".  Tale the operator closes to the numbers (*)
and use it on the nearest two numbers (5,3).  Pop those two off the
stack and replace them with the product, so now it looks like "+ 15 2".
And so-on.

It has the advantage that you need neither rules of precedence nor
parentheses to know that the * acts before the + -- it all goes in
order.

http://en.wikipedia.org/wiki/Reverse_Polish_notation

More importantly, it makes you look smart to use it, with surprisingly
little effort.  :)

ObDWJ:  I suspect Dr. Wilander uses Reverse Polish notation.

-deborah
--
There were green alligators, and long necked geese
Humpty-backed camels and chimpanzees
Cats and rats and elephants, but Lord, I'm so forlorn
I just can't find no unicorn.		-- Shel Silverstein

--
To unsubscribe, email dwj-request at suberic.net with the body "unsubscribe".
Visit the archives at http://suberic.net/dwj/list/



More information about the Dwj mailing list