4 ms·
>With a stack, things are much simpler. You don't need those clumsy memory registers or parentheses You can prefer RPN all you like, but to think it's objectiv
by Dylan16807 12y ago
>With a stack, things are much simpler. You don't need those clumsy memory registers or parentheses
You can prefer RPN all you like, but to think it's objectively better and that parentheses are flat-out bad is crazy. It's a tradeoff. The action of each key is slightly simpler, but you are forced to reorder your equation to change operator application. Sometimes this means keeping track of fewer parts, but sometimes it means keeping track of more.
- jonsen 12y agoTry this on a non-RPN calculator 3 + 4 7 + 8 ----- + ----- 5 + 6 9 + 2
- Macha 12y ago<fraction button> 3 + 4 <down> 5 + 6 <right> + <fraction button> 7 + 8 <down> 9 + 2 = (19 button presses) Or: ((3 + 4) / (5 + 6)) + ((7 + 8) / (9 + 2)) (27 button presses) vs on RPN: + / + 3 4 + 5 6 / + 7 8 + 9 2 (I think? I don't use RPN) (15 button presses) I guess 19 vs 15 button presses is a tradeoff I'm willing to make for easier understanding.
- jonsen 12y agoRPN: 3 (enter) 4 + 5 (enter) 6 + / 7 (enter) 8 + 9 (enter) 2 + / +
- DougBTX 12y agoSo 19 presses too, that's got a nice "essential complexity" feel to it.
- jonsen 12y agoFine, if you can "paint" the full equation on your calculator. But on simpler calculators people may have a hard time getting it right. 3 + 4 = / ( 5 + 6 = + ( 7 + 8 ) / ( 9 + 2 =
- sukilot 12y agoYou can elide one pair of parens. You forgot the R part of RPN.
- lambda 12y agoI'm not familiar with the fraction button. Is this common on calculators? I don't see it on most of the basic function calculators that I look at. Hmm, taking a look around, it looks like it might be present on a lot of scientific calculators, but not the basic calculators I see. I had switched to RPN by the time I started using scientific calculators, so I guess I never became familiar with this button. Parentheses are common on scientific caclulators and graphing calculators, but as you demonstrate, they add a lot of extra button presses, and you even left out the final "=". To do this on an RPN calculator, you need nothing beyond the basic 4 functions and the enter key, while you need extra specialized keys like parens or a fraction button to do it on an infix calculator. Taking a look at various infix scientific calculators, they mostly seem to have both parens and a fraction key, so using up the space of 3 keys that an RPN calculator doesn't need and can use for more actual functionality. Here's how you do it on RPN: 3 <enter> 4 + 5 <enter> 6 + / 7 <enter> 8 + 9 <enter> 2 + / + You wrote it in Polish notation rather than Reverse Polish Notation, and had left out the enter key that is used as the delimiter between two numbers (pushes a number to the stack, so you can start entering the next number).