Re:Integrated command line math
by ubasu on Tuesday July 23, 2013 @02:23PM
(#6091912)
Or:
No need to rev up python.
[ Parent
| on HN ]
I thought the same thing until I got to the part where the author used
from math import *
Which gives you significantly more options.I love this idea, I have always found math in the command line to be clunky.
That is true, but I have found if I am doing calculations that need something like the full math library of python, it's not a one-off calculation, and I am typically on octave anyway.
In any case, since I have emacs open all time, I usually do
M-x calc
for one-off calculations.
Re:Integrated command line math
by merlincorey on Tuesday July 23, 2013 @04:42PM
(#6092757)
I just evaluate random lisp in my buffers, sometimes evaluating it to output directly there. Ah emacs!
I do that too, with textadept & Lua instead of Emacs & elisp.
A little syntactic sugar (in zsh):
function calc {
print $1 | bc -l
}
Then: calc "(1+2)*3"
9
zsh actually comes with its own little calculator: zcalc "(1+2)*3"
1> 9
2>
Among other things, it features "full command line editing, including the history of previous calculations".