
Try Julia - bsg75
http://forio.com/julia/repl/
======
acangiano
Fun with Julia:

    
    
        julia> 3 ** 60
        syntax: use ^ instead of **
    
        julia> 3 ^ 60
        -3535985420588157519
    
        julia> factorial(45)
        -8797348664486920192
    
        julia> factorial(75)
        0
    
        julia> 5 * 5555555555555555555
        -9115710369641325457
    
        julia> 5 * 55555555555555555555
        syntax: invalid numeric constant 55555555555555555555
    

This isn't C. The expectations have changed thanks to scripting languages. If
I'm supposed to use this promising language to do calculations and manipulate
data, I'd expect to be able to natively handle large numbers without
overflowing.

~~~
ihnorton
Julia supports arbitrary precision arithmetic just fine, but you need to
explicitly use it. Overflow checks don't matter in Python or Ruby where
everything is relatively slow.

See also:
[http://www.johnmyleswhite.com/notebook/2013/01/03/computers-...](http://www.johnmyleswhite.com/notebook/2013/01/03/computers-
are-machines/)

~~~
acangiano
My point wasn't that it can't be done. My point was about usability and what
programmers have come to expect from a modern language. I understand that
things get trickier when trying to implement arbitrary-precision arithmetic
while keeping performance high.

~~~
ihnorton
Do you have an example of a language with arbitrary-precision overflow by
default _and_ comparable performance?

~~~
rdtsc
> Do you have an example of a language with arbitrary-precision overflow by
> default and comparable performance?

No, but that also means Julia isn't much special then either right?

Maybe it is just me but Julia positions itself as a better Python not just a
better C, in that position, can you really blame people if they misunderstand
and expect same "high level" behavior from it?

~~~
coldtea
> _No, but that also means Julia isn 't much special then either right?_

That's a really dumb conclusion. It's special in other things it offers (from
a better Matlab like language with crazy ass speed to homoiconicy and great
FFI). Who said it's only special if it fulfils some specific rainbow-unicorn
pipe dream?

It also doesn't read the programmer's thought -- so not special in that regard
either.

> _Maybe it is just me but Julia positions itself as a better Python not just
> a better C, in that position, can you really blame people if they
> misunderstand and expect same "high level" behavior from it?_

Lots of people also find Go a "better Python", and Go is like assembly
compared to Julia...

------
programminggeek
Am I crazy for feeling like Julia is the new HN darling like clojure, go,
ruby, lisp, and scala before it?

It seems like in the last week it just started popping up on HN every couple
days.

~~~
pcmonk
HN goes through phases, which I rather like. This way, we get semi-in-depth
coverage of topics serially instead of always uniformly dividing our attention
among all interesting projects at the same time.

------
kartikkumar
I've been struggling with building a C++ library for astrodynamics simulations
(anything involving the motion of objects in space) within my research group
for the last four year. The biggest problem is that for our applications,
performance-wise a lot of high-level languages just don't cut it (particularly
MATLAB, which is pushed down our throat from freshman year onwards). After
some deliberation (and before Python really caught my eye) I opted for C++.
That unfortunately brings with it an incredibly steep learning curve for new
students who typically aren't interested in programming, but just want to get
to the fun space mission analysis stuff. As a result, the project has grown a
lot, but interest is waning. Julia seems like the ideal blend between high-
level and high-performance.

As a general question, is Julia Studio the best way to go about setting up a
workflow? Or should I go with something like a Julia plugin for Sublime Text
(which I believe exists). Or are there any other tools out there that make
Julia dev straightforward?

~~~
ihnorton
Regarding workflow, the best option is IJulia
([https://github.com/JuliaLang/IJulia.jl](https://github.com/JuliaLang/IJulia.jl))
which has nice integration with plotting and useful things like LaTeX. Vi and
Emacs are well-supported, and I know the Sublime tools have gotten a lot of
attention from several people.

Not directly related to performance, but you might be interested in this:
[https://github.com/helgee/JPLEphemeris.jl](https://github.com/helgee/JPLEphemeris.jl)

~~~
kartikkumar
Very cool, thanks for the tips!

That JPL Ephemeris library has given me an idea. I think I might try porting
over the NAIF Spice [1] toolkit to Julia. It has MATLAB, IDL, C and FORTRAN
ports so I think Julia would fit right in there.

[1] [http://naif.jpl.nasa.gov/naif/](http://naif.jpl.nasa.gov/naif/)

------
Blahah
It's really easy to try Julia by just downloading it:
[http://julialang.org/downloads/](http://julialang.org/downloads/).

I'm becoming increasingly convinced that Julia is the future of technical
computing. We've just started pulling together a BioJulia team - if anyone is
interested drop an email (in profile).

~~~
sdegutis
Honestly I'm convinced it's a lot more generally applicable than scientific
computing. Much of heavy lifting I had to do in C, I can now do in Julia with
nearly the same speed and efficiency. Plus, for a lot of the problems I would
have chosen Python, Ruby, or even Clojure for, I could really see myself using
Julia now.

~~~
RivieraKid
+1 Besides libs and ecosystem in general, I don't see any advantage Python /
Ruby / Clojure have over Julia.

~~~
jsofra
Eh, in the case of Closure pervasive immutability, I don't want to write
imperative code anymore. I am sure you could write in a functional style in
Julia but all the code I have seen seems to rely pretty heavily on explicit
stateful loops. At that seems to be a design choice not just for speed but,
from what I have read elsewhere, to be familiar to Fortran and Matlab people,
seems like a bad trade off to me.

~~~
RivieraKid
Removing loops or mutability from Julia would be a terrible decision. There's
nothing inherently wrong with mutability or imperative programming.

~~~
jsofra
I just was answering the case for the advantage of Clojure over Julia as a
general purpose language. And pervasive immutability is an advantage in that
case. I agree Julia needs mutable arrays, I think for the domain it is
targeting mutable arrays are a must but that should not mean that it needs big
old imperative loops absolutely everywhere either.

~~~
RivieraKid
Imperative and mutable isn't inherently wrong, even in a general purpose
language like Julia.

In Clojure it's hard to write imperative code, which was one of the reasons
I've left. Sometimes, imperative programming is the best way to code
something. Sometimes it's best to do it in a functional way. Julia can do
both.

The same is true for mutability. I understand the advantages of immutability
but I think it's overhyped. Besides the obvious advantage of mutability -
performance - it sometimes makes for more readable and shorter code. And what
if you have some complex nested state and need to change a small part of it?

BTW - what do you mean by functional programming exactly, how does it differ
from imperative programming in your view?

------
sillonleon
The Server version of Ubuntu or the 12.04 version does not have the add-apt-
repository command. How can i add a PPA to the server without this command?
Answer in [http://askubuntu.com/questions/38021/how-to-add-a-ppa-on-
a-s...](http://askubuntu.com/questions/38021/how-to-add-a-ppa-on-a-server)

There are several options, I chose the one with sudo gedit
/etc/apt/sources.list and

1514 sudo gedit /etc/apt/sources.list 1515 sudo apt-get update #not needed
1516 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3D3D3ACC
1517 sudo apt-get update 1518 sudo apt-get install julia (there are broken
dependencies) 1519 sudo apt-get install libopenblas-base 1520 sudo apt-get
update 1521 sudo apt-get install libopenblas-base 1522 sudo apt-get install
libatlas-base-dev 1523 sudo apt-get install libopenblas-base 1524 sudo apt-get
install julia 1525 julia 1526 history | tail 1527 history | tail -n 20

------
sdegutis
Not seeing a prompt. It might be because of the internal "POST
[http://forio.com/julia/repl/sessions](http://forio.com/julia/repl/sessions)
503 (Service Unavailable)" error?

~~~
boyers
Probably got "slashdotted".

~~~
stuinzuri
Yes, we've been slammed. We are shrinking the timeout and bring up more
servers. But our capacity is not unlimited. Folks might have to come back
later.

------
rebo
Is round(x) broken?

    
    
        Julia's standard library includes a host of mathematical functions, in addition to the standard operators. Complex numbers are also supported, using the built-in im unit:
    
        round(pi) 
        lcm(54, 392, 232) # least common multiple 
        sqrt(square(100)) 
        e^(pi * im) 
        log(e ^ 2) + log10(100)
    
        When you're ready, type "next" to continue
        julia> round(pi)
        no method round(MathConst{:π},)

~~~
Debilski
round(x) only works for a few specialised types of x. help(round) tells you
that it will return the same type then. Of course for a type of MathConst{:π},
that won’t work. For generic types, you need to at least specify the number of
digits (round(pi, 3)). (See also: methods(round))

~~~
glomph
Weird that they have round(pi) as an example.

~~~
pygy_
It may have worked at some point. The language evolves pretty quickly at the
moment.

------
Stubb
Julia appears to be a perfect fit for much of what I do at work. I tried it,
got very excited, and then facepalmed earlier today. Let's define two
functions in the REPL:

    
    
        function foo()
          return 42
        end
    
        function bar()
          return foo()
        end
    

Evaluating bar() gives 42, just as one would expect.

Now let's redefine foo():

    
    
        function foo()
          return 69
        end
    

Evaluating bar() still gives 42!

Not getting something so basic correct tells me to avoid the whole thing for
fear of getting subtly screwed by some other oversight. Actually, oversight
isn't the right word, since broken automatic compilation has been a known
problem for two years:
[https://github.com/JuliaLang/julia/issues/265](https://github.com/JuliaLang/julia/issues/265).

~~~
ihnorton
_Not getting something so basic correct tells me to avoid the whole thing for
fear of getting subtly screwed by some other oversight._

No one denies that this is a problem, and it will be fixed. But I disagree
that it represents a fundamental flaw. For iterative development, it is a
minor inconvenience, so other priorities have taken precedence. If you are
redefining functions in this way in tested code, there may be bigger problems
to worry about.

The Julia developers have paid fastidious attention to correctness (to the
point of making a pilgrimage to visit Kahan early on). The type system is well
thought-out and nice to use. Spurious crashes are almost nonexistent (and
fixed within hours, without fail). The foundation is solid, but it's still a
work in progress, and it will take some time to shake these sorts of features
out.

~~~
Stubb
I was cheering out loud when I first downloaded Julia and started working with
it. The type system, multiple dispatch, so much win! I'm working on
ionospheric ray tracing at my day job and would love to use Julia.

But when I can write a nine-line example that produces incorrect output—no
thanks. Especially when one of the lead developers (see the linked thread)
states that supporting function redefinition isn't needed for v1.0. Clearly
these people are working under a very different set of priorities than me.

"The foundation is solid"—I do not think it means what you think it means.

~~~
coldtea
> _Clearly these people are working under a very different set of priorities
> than me._

Yes, they are pragmatists.

Plus they know that the language is the first priority, not the REPL.

------
williamstein
You can also try Julia in your browser here:
[https://cloud.sagemath.com](https://cloud.sagemath.com) However, you have to
(1) make a free account, (2) create a project, (3) open project, click on
"+New", click Terminal, (4) type "julia". If you create a .jl file instead of
a Terminal (at +New), you'll have proper Julia syntax highlighting and
indentation; you can then run that file from the terminal... (Disclaimer: I'm
the founder of SageMathCloud.)

~~~
NicoJuicy
You could have had more users if your url was:

[https://cloud.sagemath.com/new/jl](https://cloud.sagemath.com/new/jl) ;-)

------
forkandwait
Can julia yet do the equivalent of the following Octave code:

proportion_value = x ./ sum(x)

The blocker for me with julia is translating my vectorized way of thinking
into loops. I know the loops are optimized, but yuck.

~~~
RivieraKid
Yes, this works in Julia without any changes.

------
sillonleon
Julia is very fast, 0.12 second, 0.60 second for sbcl (lisp)

julia>function haz(n) s = 0 for i in 1:n if i % 2 == 0 s = s+1 else s = s-1
end end s end haz (generic function with 1 method)

julia> @elapsed haz(10^8) 0.12459633

Compare with lisp sbcl on the same machine:

(defun haz(n) (let ((s 0)) (declare (optimize (speed 3) (safety 0)) (fixnum n
s)) (loop for i fixnum from 1 upto n do (if (zerop (mod n 2)) (incf n) (decf
n)) finally (return s))))

------
plg
A lot of the comments I see about Julia (and other trendy high level
languages) are of the following form:

"I can do things I needed C to do before, and almost as fast"

which leads me personally to ask,

If you could do this in C before, and faster, then why are you switching?

Most people will say "because C is bad/difficult/clumsy for doing X"

which leads me to say,

why are you using C to do X?

I sincerely believe (as a computational scientist) that a combination of a
high-level language for real-time interactive exploration and prototyping with
a fast language like C for doing the actual gruntwork, is the best.

Attempts to combine the best of C (speed) with the best of scripting languages
(easy to do things fast without having to pay attention to what you are doing)
in my opinion end up merely joining the worst of both worlds rather than the
best of both worlds.

Besides isn't programming about being specific? Do you really want to code
stuff without having to worry about the details?

~~~
catinsocks
You can see it as an alternative to Matlab/R (sorta)/numpy not C.

People only ever used C when speed was crucial and depending on what you were
comfortable in or what you had learned maybe Fortran for speed instead of C.

Julia is meant for scientific computing with some nice features. As I see it
it is similar enought to Matlab to be easily learned by those who use Matlab
but has enough goodies that it can be a viable alternative.

Programming isn't about being specific it is about accomplishing a task and
many times yes you don't want to have to worry about the details as long as it
works the way it should.

~~~
plg
I agree with what you say. More and more though as I get on in my career as a
scientist I realize though that the details turn out to matter, sometimes a
great deal.

Anyway I'm all in favour of an open, fast MATLAB alternative

------
mlubin
koding.com is another way to get an interactive REPL online:
[https://koding.com/Julia](https://koding.com/Julia)

~~~
jnazario
oh awesome resource, thanks for the link! (looks down from overuse right now
but still, cool!)

julia++, i started playing with it this weekend and i'm super pleased. i
concur with another comment in this discussion that this is what i wish python
had been evolving into. it gets me wondering if python is maybe being left
behind compared to other dynamic languages or if it's just fad-ism at work (or
me just learning more about languages and features).

------
tbarbugli
a big white page is not really the best introduction ever (or am i missing the
point/humor?)

~~~
bsg75
It was working, until I submitted it here. Maybe too many people Trying Julia.

~~~
stuinzuri
Yup, we've been properly slashdotted. Attempting to bring up more servers and
shrinking session timeout. But...

------
jonhmchan
Doesn't seem to work - would love to find a great resource on Julia

~~~
sdegutis
I've found the docs[1] to be extremely easy to follow, as a nice blend between
a tutorial and a spec.

[1]:
[http://docs.julialang.org/en/latest/manual/](http://docs.julialang.org/en/latest/manual/)

------
LinaLauneBaer
Adblock on Chrome is blocking the command prompt by default. At least on my
system...

------
axilmar
After typing next about 20 times without seeing anything interesting, I quit.

------
nelmaven
Everything returns:

    
    
       Undefined
       500
    

Is this broken?

~~~
stuinzuri
Our Julia REPL servers been slammed. We are shrinking the timeout and bring up
more servers. But our capacity is not unlimited. Folks might have to come back
later. Sorry about that.

------
joshfraser
The pi constant didn't work for me

------
elwell
no method round(MathConst{:π},)

~~~
eskimo87
+1

