Live data from Hacker News

Julia 0.2 released

github.com

11–20 of 43 posts

Re: Julia 0.2 released

#11
julia seems to be positioned as a kind of matlab / r replacement. but i'm finding it works very well as a faster python, for the kind of programs i am writing in my free time (learning about / analysing block ciphers, most recently).

its big idea is multiple dispatch, like clos (oo-lisp) multimethods. where you would define an "underscores" method in python (ie to extend the language for a new class), in julia you define appropriate functions for that type - the cute thing being that the new type doesn't have to be the first parameter.

so, for example, the equivalent of

    class Foo:
        def __repr__(self):
            ...
would be

    function show(io, f::Foo)
        ...
    end
and the end result is something that has more of a FP flavor than python. it's very appealing.

if you're looking for a "dynamic scripting" language that takes some of the good bits from static typing, and has decent performance, it's worth a try.

Re: Julia 0.2 released

#12

After using it for smaller projects, one of the few things I don't like is multidimensional arrays. I would prefer if only arrays of arrays were possible and had some syntax sugar. Edit: And perhaps some special treatment by the compiler for optimization. I find multi-d arrays counter-intuitive and clumsy on some situations. Also, currently I'm forced to write ugly code like array[x,y][i].

You can of course use arrays of arrays if you like, but multidimensional arrays are indispensable for numerical work, especially linear algebra – matrices are 2D arrays after all. When doing numerical work in C, for example, you have to simulate multidimensional arrays by doing your own index calculations to translate back and forth between linear indexing and N-d indexing. Having language support for this is a must if you want to target numerical programming.

Re: Julia 0.2 released

#13
For anyone interested in using Julia for numerical optimization/mathematical programming, see http://juliaopt.org/.

We have pure-Julia implementations of standard unconstrained methods [1] as well as a domain-specific modeling language [2] for (integer) linear programming with links to open-source and commercial solvers. Julia's performance and advanced language features such as metaprogramming really make it a great language for optimization [3].

[1] https://github.com/JuliaOpt/Optim.jl

[2] https://github.com/JuliaOpt/JuMP.jl

[3] http://www.mit.edu/~mlubin/juliacomputing.pdf

Re: Julia 0.2 released

#14

After using it for smaller projects, one of the few things I don't like is multidimensional arrays. I would prefer if only arrays of arrays were possible and had some syntax sugar. Edit: And perhaps some special treatment by the compiler for optimization. I find multi-d arrays counter-intuitive and clumsy on some situations. Also, currently I'm forced to write ugly code like array[x,y][i].

I haven't used Julia yet, but would be curious to hear more about your experience. Was it overall positive? How does it compare with your experience using other languages?

I'm on mobile so just a summary - I have tried tens of languages and Julia is the probably my second-most favourite (first is Ceylon). I'm really impressed by it and can highly recommend.

Re: Julia 0.2 released

#15

After using it for smaller projects, one of the few things I don't like is multidimensional arrays. I would prefer if only arrays of arrays were possible and had some syntax sugar. Edit: And perhaps some special treatment by the compiler for optimization. I find multi-d arrays counter-intuitive and clumsy on some situations. Also, currently I'm forced to write ugly code like array[x,y][i].

You can of course use arrays of arrays if you like, but multidimensional arrays are indispensable for numerical work, especially linear algebra – matrices are 2D arrays after all. When doing numerical work in C, for example, you have to simulate multidimensional arrays by doing your own index calculations to translate back and forth between linear indexing and N-d indexing. Having language support for this is a must…

So if I understand it correctly, it's for efficiency? What about some special treatment by the compiler, is something like that possible?

Re: Julia 0.2 released

#18

julia seems to be positioned as a kind of matlab / r replacement. but i'm finding it works very well as a faster python, for the kind of programs i am writing in my free time (learning about / analysing block ciphers, most recently). its big idea is multiple dispatch, like clos (oo-lisp) multimethods. where you would define an "underscores" method in python (ie to extend the language for a new class), in julia you de…

I think another big advantage of CLOS that Julia took is that you can dispatch on the type of not just the first argument but on the combination of the types of all the arguments

Re: Julia 0.2 released

#19

Earlier quoted context omitted.

You can of course use arrays of arrays if you like, but multidimensional arrays are indispensable for numerical work, especially linear algebra – matrices are 2D arrays after all. When doing numerical work in C, for example, you have to simulate multidimensional arrays by doing your own index calculations to translate back and forth between linear indexing and N-d indexing. Having language support for this is a must…

So if I understand it correctly, it's for efficiency? What about some special treatment by the compiler, is something like that possible?

Memory layout mostly. For example, a 10x10 64-bit floating-point matrix should be stored as contiguous chunk of 100 inline 64-bit floats. This is quite different than an array of arrays, which is represented as an array of pointers to separate boxed 1-d array objects. The contiguous layout is not only far more efficient, but also is what all numerical libraries like LAPACK and FFTW expect. If numerical arrays were not laid out like that in Julia, then we wouldn't be able to do fast linear algebra or FFTs.

Of course, sometimes you do want an array of arrays, such as when each array needs to have a different length or element type – which you can of course do. Which is why I'm a bit confused about how having support for multidimensional arrays is a problem. If you find them confusing, why not just ignore the feature and use arrays of arrays all the time?

I'm also not clear on what "special treatment by the compiler" means.

Re: Julia 0.2 released

#20

julia seems to be positioned as a kind of matlab / r replacement. but i'm finding it works very well as a faster python, for the kind of programs i am writing in my free time (learning about / analysing block ciphers, most recently). its big idea is multiple dispatch, like clos (oo-lisp) multimethods. where you would define an "underscores" method in python (ie to extend the language for a new class), in julia you de…

I think another big advantage of CLOS that Julia took is that you can dispatch on the type of not just the first argument but on the combination of the types of all the arguments

Multiple dispatch is very powerful paradigm and Julia takes it a good bit further even than CLOS. There's a good comparison of Julia and CLOS in terms of parametric types and dispatch in Julia's Wikipedia entry:

https://en.wikipedia.org/wiki/Julia_(programming_language)#L...

It also compares with Dylan and Fortress, which are the other major non-research multiple dispatch languages. The unique combination of features that Julia has is

1. a fully dynamic type system (code with type annotations is still dynamically typed)

2. functions are all generic by default, including all the built-ins and operators

3. support for parametric types that you can dispatch on.

This combination of features working smoothly together turns out to be very powerful, especially when designed so that you don't have to talk about types except when you want to.

Post reply on HN