6 ms·
Calc is so useful to have right there. I have never used Windows calc since discovering the emacs one many years ago. Once I got used to it I had to find an RPN
by shoover 9y ago
Calc is so useful to have right there. I have never used Windows calc since discovering the emacs one many years ago. Once I got used to it I had to find an RPN one for my phone (RealCalc and PCalc for Android and IOS, respectively).
Algebraic formulas are great but beyond my typical reuse recall duration.
- wiz21c 9y agoCould you explain why you feel RPN is better for you ? I've never been able to get used to it... Maybe I get it wrong...
- deleted 9y ago[deleted]
- eadmund 9y agoAfter you get used to it, you end up being able to calculate much more quickly. It's basically having a little Forth machine in your hand or at the end of your keyboard.
- macintux 9y agoThe joy of never, ever having to type a parenthesis must be experienced to be appreciated.
- brians 9y agoAnd yet so many RPN people are Lisp programmers the rest of the time. I guess it balances out.
- thomastjeffery 9y agoI would really like a postfix lisp. I wonder what edge cases I would run into designing one.
- macintux 9y agoAren't concatenative languages like Forth and Factor essentially what you're looking for?
- thomastjeffery 9y agoThey are very focused on the stack, which isn't very lispy. I was wondering how difficult it would be to make a common lisp or scheme, but with postfix syntax instead of prefix.
- kazinator 9y agoWe could start by tinkering with a silly macro: [10]> (defmacro rev (&rest forms) `(progn ,@(mapcar (lambda (form) (if (and (consp form) (rest form)) `(,(car (last form)) ,@(butlast form)) form)) forms))) REV [11]> (rev (1 1 +)) 2 [12]> (rev (3 print) (1 1 +)) 3 2
- kazinator 9y agoStart by writing some small programs in this; what exactly is the syntax? A Lisp macro (rpn ...) could provide a DSL whereby all the forms in ... are recursively code walked and turned from a postfix notation into a regular Lisp notation. You probably want the walker not to fiddle with expressions like '(a b c) quoted lists. That creates a special case to handle. You have to know that (quote (a b c)) is in a context where it is evaluated (which normally undergoes rpn to Lisp transformation) and so should be left alone. You don't want (quote z) being treated as RPN denoting (z quote)! Likewise, you don't want #'foo, which is (function foo) to be turned into (foo function). So, basically, a code walker is needed which knows what is evaluated and what isn't, which leaves alone stuff that isn't evaluated, and also avoids RPN-to-lisp-transforming certain expressions that are evaluated.
- jonsen 9y agoFor me RPN is just the way a calculator should function. But I'm not shure I could explain why. Some of the explanation is ".. it gives you more insight into your calculations than using the ‘algebraic’ systems used by other calculators and it keeps you and not your calculator (see Appendix D) in command of what is calculated." from here: https://hansklav.home.xs4all.nl/rpn/index.html https://hansklav.home.xs4all.nl/rpn/index.html
- brians 9y agoTwo reasons. With an algebraic system, I have to plan ahead and add open parentheses, or reorder, to do what I want. With a stack, I can always push/dup, then roll or pop back. It’s the same reason I like having function calls and a call stack when programming, compared to APL. Second reason, RPN systems are typically open: I or others can add operations. That’s pretty rare in an algebraic machine, though not completely nonexistent.
- jonsen 9y ago.. plan ahead and add open parentheses, or reorder, .. The classic example 3 + 4 7 + 8 ----- + ----- 5 + 6 9 + 2 Strait forward in RPN 3 ^ 4 + 5 ^ 6 + / 7 ^ 8 + 9 ^ 2 + / +
- thomastjeffery 9y agoIt separates naming from evaluating. I have to bake 7 pies... 7 and each pie takes 45min 7 45 * => 315 But I can fit 3 pies in the oven at a time 7 45 * 3 / => 105 Using infix notation, I would need to consider order of operations, and put operators before data, increasing the mental stack size. Using a postfix calculator, I can just throw values onto the stack, and start consolidating them with operations.
- shoover 9y ago1 point by shoover 0 minutes ago | edit | delete [-] I’m not sure :) I think it’s because the stack makes it easier to see the state of the calculation, whereas without RPN I have to keep more in my head and can’t see it. Basically what thomastjeffrey said.
- deleted 9y ago[deleted]