Live data from Hacker News

Julia as a CLI Calculator

krasjet.com

41–50 of 134 posts

Re: Julia as a CLI Calculator

#42
post #3

I love the julia language. I would love to use julia as a command line calculator. Unfortunately, starting the interpreter is excruciatingly slow, an order of magnitude slower than octave or python (and several orders of magnitude slower than bc or dc).

I suspect that the author starts the julia REPL up in the morning and leaves is running all day, so startup time would not be important.

Re: Julia as a CLI Calculator

#43
post #19

I use python CLI for exactly the same :)

I have been using python like this for over two decades. In fact these days I almost never write Python programs themselves, not liking the language much at all anymore. But I still habitually fire up Python to do calculations.

I may switch to Julia, though. I really prefer the language. Wish I could use it at work.

Re: Julia as a CLI Calculator

#44

Since this is a calculator topic, I'd like request your input on which calculators you use. I use the Emacs calculator (M-x calc) and XCalc ( http://www.tordivel.no/xcalc/ ) as I like to use RPN calculators. The Windows 10 calculator is painful and slow. XCalc has a mini mode, where it will sit as a small, single line without distracting you too much. I like that feature very much. One thing with Emacs is that I forg…

As a RPN calculator user, my first choice is XCalc (http://www.tordivel.no/xcalc/).

The non-RPN one that I use the most is SpeedCrunch (http://speedcrunch.org/), Insect (https://github.com/sharkdp/insect/) and Frink (http://frinklang.org/). All have unit conversion too.

Re: Julia as a CLI Calculator

#45
post #3

I love the julia language. I would love to use julia as a command line calculator. Unfortunately, starting the interpreter is excruciatingly slow, an order of magnitude slower than octave or python (and several orders of magnitude slower than bc or dc).

I suspect that the author starts the julia REPL up in the morning and leaves is running all day, so startup time would not be important.

I have a Lisp process that has been running for weeks now (window manager + devel. stuff), and any time I need to compute something I can go the REPL.

I suppose Snail could be used in a same way (https://github.com/gcv/julia-snail)

Re: Julia as a CLI Calculator

#46

Since this is a calculator topic, I'd like request your input on which calculators you use. I use the Emacs calculator (M-x calc) and XCalc ( http://www.tordivel.no/xcalc/ ) as I like to use RPN calculators. The Windows 10 calculator is painful and slow. XCalc has a mini mode, where it will sit as a small, single line without distracting you too much. I like that feature very much. One thing with Emacs is that I forg…

Python repl in a newly opened terminal session. Which is similar to the posted submission.

During grad school, I went through a period of trying many different GUI based calculators, until I realized what I really wanted was a language's repl.

Re: Julia as a CLI Calculator

#47
I use Mathematica as my advanced calculator. It’s a functional language with an extremely vast and consistent mathematical and non-mathematical library, top notch symbolic capabilities (SymPy is just child’s play in comparison), top notch numerical capabilities, and very decent performance. You certainly don’t need to write your own rotation function — well, 2D rotation is trivial, but what if you want 3D rotation around a vector? Mathematica’s got you covered. Got a command line mode too, see MathKernel.

The downside: it’s not free (as in beer or speech).

Re: Julia as a CLI Calculator

#48

I really wish there was a language based on Swift that would include most of the nice language, REPL and library characteristics of Julia (and perhaps few from Dart). That would get really close to a "perfect language" for me. Overall I like Julia - and use it as a CLI calculator as well - but there are several things that prevent it from being a good general purpose language: - OOP support is "meh". - str.parse(Int)…

> str.parse(Int).abs is more readable than abs(parse(Int, str)). Oof, beauty is in the eye of the beholder. I appreciate the regularity of abs(parse(Int, str)) rather than remember what to call as a function, and what must be called as a method of some object. Of course my preference would be for a syntax that has the added benefit of getting rid of extraneous commas: (abs (parse int str)) > 1-based indexing Again, b…

> Oof, beauty is in the eye of the beholder.

I guess that's true, from my experience Julia's way is simply less readable. It also make IDE autocomplete much more useful.

> A lot of relevant math is 1-indexed.

Initially I kind of liked it and disagreed with people who didn't. But as I used Julia over time, I regularly encountered situations in which it was really frustrating and enacted a mental tax. The opposite never happens.

Re: Julia as a CLI Calculator

#49
post #29

Earlier quoted context omitted.

This is simply not true. I have a 3 year old mac, and this is doing simple arithmetic (including starting and exiting Julia). 0.14 seconds user time. $ time ~/Desktop/Julia_Releases/Julia-1.4.app/Contents/Resources/julia/bin/julia -E "1+1" 2 ~/Desktop/Julia_Releases/Julia-1.4.app/Contents/Resources/julia/bin/julia -E 0.14s user 0.08s system 65% cpu 0.342 total In about 0.5 seconds, I can actually do something non-tri…

By half a second I obviously didn't mean 0.5 seconds but rather a very short duration that I didn't bother to measure. Edit: Now I bothered to measure. You were saying? ~ time julia -E "1+1" 2 julia -E "1+1" 0,59s user 0,14s system 153% cpu 0,476 total ~ time julia -E "sum(sin.(rand(1000000)))" 459807.21199623536 julia -E "sum(sin.(rand(1000000)))" 1,01s user 0,17s system 125% cpu 0,948 total

Which version of Julia are you using?

My main point was that while half a second (~0.5s) is perceptible startup time, ~0.1s is not. Is it a much older system than mine? I have a 2.3GHz Core i5 from about 2017.

Re: Julia as a CLI Calculator

#50

Since this is a calculator topic, I'd like request your input on which calculators you use. I use the Emacs calculator (M-x calc) and XCalc ( http://www.tordivel.no/xcalc/ ) as I like to use RPN calculators. The Windows 10 calculator is painful and slow. XCalc has a mini mode, where it will sit as a small, single line without distracting you too much. I like that feature very much. One thing with Emacs is that I forg…

For simple quick things I use ksh $((expressions)).
Post reply on HN