Live data from Hacker News

Julia as a CLI Calculator

krasjet.com

71–80 of 134 posts

Re: Julia as a CLI Calculator

#71
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).

How long does it take to start on your computer? If I have run it before. It takes less than 0.25 seconds. I use a several years old Mac. On none of my computers do I experience startup times which has any practical relevance to being productive.

The only real problem I have experienced in Julia is using plotting libraries and those you can include in your Julia image with PackageCompiler.

Re: Julia as a CLI Calculator

#72
post #68

The typography in this post is beautiful (as well as the content), anybody know where this comes from? Did the author do it by hand or is it something off the shelf? Asking for a friend...

Here's the typeface https://typeof.net/Iosevka/

What struck me was the [ t a b ] stuff as well as the Latex reference, which looks to be embedded img in src, so there must be some sort of preprocessor?

Re: Julia as a CLI Calculator

#73
post #2

This seems to be a very neat intro into Julia and a practical use case. I’ve been postponing to learn the language for a while now, but from what I heard/seen it seems to be extremely well designed.

I used it as my CLI calculator, just like the articles title. I used to use Ruby for this, but Julia is more concise but still readable. Concise enough I have written useful applications that can fit in a tweet.

Re: Julia as a CLI Calculator

#74

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)…

[deleted]

Re: Julia as a CLI Calculator

#75
post #62

Earlier quoted context omitted.

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.

I'm using 1.4 on an Intel i5 4460, so about 3 years older but not a laptop cpu. I don't even think 0.5 seconds are that noticeable...

“3 years older but not a laptop cpu” might mean “spinning disk”, rather than SSD, too.

Re: Julia as a CLI Calculator

#76
post #68

The typography in this post is beautiful (as well as the content), anybody know where this comes from? Did the author do it by hand or is it something off the shelf? Asking for a friend...

The styling is done from scratch.

For more information, see the colophon [1] and karasu [2].

[1]: https://krasjet.com/colophon/

[2]: https://github.com/Krasjet/karasu

Re: Julia as a CLI Calculator

#77

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…

I have all commands I don't remember bound to leader keys. When in calc I have [leader key] m and then which-key pops up everything I have stored.

Other than that, I use scratch in elisp mode and eval. Not as fluent as magnars, but this is a good example of what I mean (towards the end): https://youtu.be/jNa3axo40qM

Re: Julia as a CLI Calculator

#78
post #6
post #5

Earlier quoted context omitted.

Simply loading the REPL takes half a second for me. I use it all the time as a simple calculator.

> Simply loading the REPL takes half a second for me. I juse it all the time as a simple calculator. Half a second is precisely what is meant by "excruciatingly slow". If I need a simple calculator, I expect to be able to use it to compute intermediary results in a shell loop. If my loop has one thousand iterations, you are spending about 10 minutes just initializing the interpreter. This is absurd. Of course, you ca…

> If I need a simple calculator, I expect to be able to use it to compute intermediary results in a shell loop.

No offense but that must be one of the dumbest ideas I have heard in a long time. The reason you write something in a shell script is because it is portable on all Unix systems. If you add a dependency to a particular programming language like Julia, then that portability is out the windows. You require installing users to install Julia first.

If you require users to install Julia, you might as well ditch the shell script all together. All shell languages suck anyway for anything non-trivial.

I have rewritten plenty of shell scripts to Julia. It is much faster to write. The code is easier to read and understand and it executes way faster than any shell script.

Running a complicated shell script that calls out to Julia 1000 times makes absolutely NO SENSE! It is a completely contrived example with no practical application.

Besides when people say "calculator," I think most reasonable people assume an interactive system for doing calculations, not a glorified math library. Julia offers a great interactive environment for doing calculations.

Re: Julia as a CLI Calculator

#79
This is a great article - interesting, well-written and beautifully presented!

A minor quibble in the typography - the use of small caps for every initial letter is slightly catching my eye every time I see it. Perhaps I don't see enough similar typography on the web to make it feel more natural ¯\\_(ツ)_/¯ ...

Re: Julia as a CLI Calculator

#80
I've been using Julia as my CLI calculator for a few years now - cool to see this post! While teaching an online Linear Algebra class, I would use Julia to construct examples and quickly solve them. The syntax sugar of all the functional idioms make it very fun and easy to express more complicated ideas. This is a cool introduction- I was not aware (or had forgotten) about function chaining. Really curious about using more of Latexify as well :)

On an unrelated note, (as a mathematician) I have started using Maple a lot more as my analytic computational helper. Never really gave it the time of day in years past - it is quite powerful and intuitive. Funny note: I recently copied and pasted output of a Maple command into my Julia code and it was syntactically correct!

Post reply on HN