Emacs financial calculations: https://plus.google.com/+AndrewHyatt/posts/YdwsbNmZ4NL
 Index of Andrew Hyatt's emacs calc tutorials: https://blog.markhepburn.com/2013/12/07/andrew-hyatts-emacs-...
 Emacs Google Plus community: https://plus.google.com/communities/114815898697665598016
Since then I am practically a daily user.
It's not without downsides, and some simple workflows that seem common and trivial to me personally feel a bit awkward and contorting. For example, working with variables/equations, with that '=>' "operator", is rather strange. There also seems to be no support for hex numbers in 0x-prefixed lowercase notation, which makes it hard to impossible to just copy and paste hex numbers for programming. And while emacs-calc has a very impressive scientific unit system, often I just want to use unit prefixes, like u,m,M for micro,milli,Mega respectively, without having to resort to using actual physical units in my calculations (and then finding out again how to simplify appropriately).
I also almost don't use the trail at all, mostly because its navigation and actioning feels tedious and downright archaic, making me think that emacs-calc probably started out a few decades ago, with a specific, now outdated, terminal paradigm in mind.
But all in all, it's pretty impressive, and fills the role as my daily companion for quick, and sometimes more elaborate, computations well.
nickle has normal algebraic notation with arbitrary precision, configurable base input/output for every expression (very reminiscent of calc), math functions and C operators work out of the box. It has variables, as well as a simple c-like language for additional extensions.
If RPN is not for you, "nickle" is a perfect "bc" replacement which works as you would expect.
The only downside is that, like any advanced Emacs functionality, if you don't use it frequently you forget all the commands.
I thought this was happening only to me... but I’ve ditched Vim and went Emacs 100% so it’s bit better now, since I’ve been stuck with using both for like a year.
For the reason you mention, I need to get into the habit of using Calc for my quick calculations; right now, I usually use Google (ick, infix notation) or dc.
I'll give it a go.
I might buy another HP28 for the car. :D
http://www.speedcrunch.org/download.html even links to 32- and 64-bit prebuilt Qt binaries for Linux. Nice.
For computations such as 10+3, it's comparabale. But I give SpeedCrunch an dedge because it can compute "sin(pi/2)" out of the box.
I still can't wrap my brain around a RPN calculator well enough to use it productively (but boy howdy can I tell you how the stack engine works!). All the cool kids in physics class in the 80's were using HP's, and I felt left out even then. Never managed to make it work for myself.
Normal (non-algebraic) calculators are inconsistent. To get "2+3", it's infix: 2, +, 3, =. To get "cos(45)" it's postfix: 45 cos (and no equals). And something like "cos(2+3)" is a mixture of both. RPN, is always the same, numbers first, then operators, and usually more keystroke efficient. Some operators take multiple arguments.
RPN also has the advantage of (rarely) needing a memory register, since the values can be left on the stack and accessed as they are needed.
It takes a little practice to start thinking postfix, but it's a relief to not consider order of operations, and tends to be a lot more consistent with how I do arithmetic in my head in the first place.
Just prefix every expression with '
Algebraic formulas are great but beyond my typical reuse recall duration.
I have to bake 7 pies...
and each pie takes 45min
7 45 *
But I can fit 3 pies in the oven at a time
7 45 * 3 /
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.
".. 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
I wonder what edge cases I would run into designing one.
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.
I was wondering how difficult it would be to make a common lisp or scheme, but with postfix syntax instead of prefix.
> (defmacro rev (&rest forms)
`(progn ,@(mapcar (lambda (form)
(if (and (consp form) (rest form))
`(,(car (last form)) ,@(butlast form))
> (rev (1 1 +))
> (rev (3 print) (1 1 +))
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.
The classic example
3 + 4 7 + 8
----- + -----
5 + 6 9 + 2
3 ^ 4 + 5 ^ 6 + / 7 ^ 8 + 9 ^ 2 + / +
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.
It tries to include features of a Casio scientific calculator, so includes things like statistics / regression (of selected block) and engineering notation display. It inserts underscores between every three digits for easier reading: 0.123_456
It is not reverse polish.
Well, some might call that a good definition of scope creep, but at this point I'm sure we're all well aware that even though Emacs might be called a text editor, that's not really all it is.
In the end it’s often less trouble to switch over to the browser window that’s already open anyway and copy and paste data between it and emacs.