News for hackers. Stuff that matters.
Re:Why Does Julia Work So Well? by mcv on Wednesday October 21, 2020 @07:22AM (#24846679)
> ∇f(u) = α*u; ∇f(2)

> sin(2π)

Is that legal Julia? That's pretty awesome, but how do I type this? I think I need a new keyboard.

Re:Why Does Julia Work So Well? by pa7x1 on Wednesday October 21, 2020 @07:58AM (#24846921)
It's legal Julia.

Julia editors or VS Code with the Julia plugin support LaTeX commands and will perform autocompletion and convert it to the unicode character.

For example, if you write \nabla it will offer autocompletion and write ∇.

I think it's a neat feature and makes a lot of sense in scientific computing contexts but I feel I wouldn't like a code-base that abuses it too much. Sprinkled here and there can help make code more readable, succinct and pleasant.

Re:Why Does Julia Work So Well? by mcv on Wednesday October 21, 2020 @09:43AM (#24847791)
I think it's great for mathematicians, but I shudder to think what some Scala library builders might do if they get there hands on this.
Re:Why Does Julia Work So Well? by st1x7 on Wednesday October 21, 2020 @09:42AM (#24847780)
> but I feel I wouldn't like a code-base that abuses it too much

This is why I think it was a poor design choice to include the feature and actively encourage its use. The benefit of potentially more succint code is far outweighed by having to look with a codebase written entirely in Greek and there's no way to enforce moderation.

Re:Why Does Julia Work So Well? by pa7x1 on Wednesday October 21, 2020 @12:21PM (#24849309)
It's impossible to impose moderation in any language and you don't need unicode characters to write stupid code. Java programmers were writing HelloWorldFactory classes way before Julia existed.
Re:Why Does Julia Work So Well? by kescobo on Wednesday October 21, 2020 @11:54AM (#24849035)
Style guide for the base language is to generally stick to ascii, and many of the big packages do that too. It's really nice in examples, analysis scripts and the like though.
Re:Why Does Julia Work So Well? by jaster on Wednesday October 21, 2020 @07:31AM (#24846732)
The REPL (and most tooling I think) supports LaTeX-like abbreviations that autocomplete to the corresponding Unicode symbol, so no need for a special keyboard.

See here https://docs.julialang.org/en/v1/manual/unicode-input/

Re:Why Does Julia Work So Well? by elcomet on Wednesday October 21, 2020 @07:31AM (#24846729)
You can write \pi and then press tab. It works in the julia repl, and also on most editors that have julia plugins.

Works for all greek letters, and other unicode characters.

Re:Why Does Julia Work So Well? by Rygian on Wednesday October 21, 2020 @07:41AM (#24846801)
Every Western-style input method should come with a Compose function enabled, and a simple tutorial on how to use it.

For example, on Windows I use Wincompose [1], that lets me type things like "⋄*g" for Greek gamma: 'γ', or "⋄ee" for 'ə', or even "⋄⋄plane" for a '' (and of course the list is customizable). The "⋄" symbol represents the Compose key, which I chose to map to the Caps Lock key on my keyboard.

[1] http://wincompose.info/

Edit: HN removed the airplane icon.

Re:Why Does Julia Work So Well? by mcv on Wednesday October 21, 2020 @09:49AM (#24847851)
I've been thinking about a dynamic keyboard where each key is a tiny oled screen that shows what character you're going to type in this particular mode. And then you're free to switch from regular to math to Greek to Chinese if you want, and the keyboard simply adjusts.
Re:Why Does Julia Work So Well? by Rygian on Friday October 23, 2020 @04:56AM (#24867315)
Such as Optimus Maximus, for example?

https://www.youtube.com/watch?v=qj7GYU-wedo