Live data from Hacker News

Julia 0.2 released

github.com

31–40 of 43 posts

Re: Julia 0.2 released

#31

Earlier quoted context omitted.

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…

> Dylan and Fortress, which are the other major non-research multiple dispatch languages

What about R with S4 classes?

Re: Julia 0.2 released

#32

Does anyone know what the state of plotting is in Julia? I couldn't really find any convincing examples for that. For many applications, plotting really is a big requirement. That said, I look forward to a future where Julia will take over many use cases that are served by Matlab right now.

there's a package (called gadfly) that works like r's ggplot2. i haven't used either a huge amount, so it's possible the julia version has gaps, but i could produce basic, very attractive graphs with ease in both languages.

Re: Julia 0.2 released

#33
post #17

How suitable is it to use for mainstream programming (building web app, etc)

Mainstream is a very context specific term. Julia is not a general purpose language, it's primarily for numeric computing. Within the domain of technical computing it's one of the most expressive languages.

Re: Julia 0.2 released

#35

I'd love to switch to Julia, but I rely on a lot of packages that are only available in R (e.g. lots from http://bioconductor.org/ ). Is there any way to call R code from Julia?

https://github.com/lgautier/Rif.jl is what you're after.

The code to call R is a bit ugly, but it looks straightforward to learn.

Re: Julia 0.2 released

#36

Earlier quoted context omitted.

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…

> Dylan and Fortress, which are the other major non-research multiple dispatch languages What about R with S4 classes?

Fair point, although R's multiple dispatch barely counts as a language feature at all, but is really more of a standard add-on library (read on). All S4 is doing is using a hash table keyed by method signatures to look up which function body to call. You don't even need any syntactic support since "defining a generic function" is just a matter of defining a function that does a hash lookup and then applies that function to its arguments. R doesn't provide any syntactic support for adding methods to generics – you literally have to give it a vector of strings of argument class names. Since you can do all of this in any language – even C – it's arguable that multiple dispatch isn't really part of "the R language" at all, but rather "the R system" happens to ship with a standard implementation of hash-based multiple dispatch and a few of the built-in function like "show" and "plot" are defined using it.

Due to not being a deep language feature, S4 lacks some crucial abilities. It doesn't support any sort of type hierarchy besides the special "ANY" class. Without the ability to define a type hierarchy and program to abstract types, most of the power of multiple dispatch evaporates. Even though it is technically an implementation detail, I've found that performance is a critical feature for multiple dispatch to really come into its own. R's S4 dispatch has been described as "slower than S3" [1] – and S3 dispatch is not exactly fast. Unless really basic things like + and array indexing can be generic and usably fast, you're not really cooking with gas.

[1] http://www.r-project.org/conferences/useR-2004/Keynotes/Leis...

Re: Julia 0.2 released

#37
post #30

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…

I'm confused about your reference to C. C has multidimensional arrays, and all the elements are laid out contiguously in memory. No index calculations are needed, it's all done by the array indexing operation. If you have this code: int a[10][10]; then: &a[x][y] == ((char *)a + x * sizeof(a[0]) + y * sizeof(a[0][0])) where sizeof(a[0]) is == sizeof(int) * 10. quick edit: added a (char *) cast so the arithmetic doesn'…

Right, I should have clarified. That works for statically allocated arrays but not for dynamically allocated ones. Since matrix dimensions are generally not known ahead of time, in real programs you almost always end up needing to simulate multiple indices using explicit index arithmetic.

Re: Julia 0.2 released

#38

Earlier quoted context omitted.

> Dylan and Fortress, which are the other major non-research multiple dispatch languages What about R with S4 classes?

Fair point, although R's multiple dispatch barely counts as a language feature at all, but is really more of a standard add-on library (read on). All S4 is doing is using a hash table keyed by method signatures to look up which function body to call. You don't even need any syntactic support since "defining a generic function" is just a matter of defining a function that does a hash lookup and then applies that funct…

Thanks for the explanation. What do you mean by "It doesn't support any sort of type hierarchy"? I've contributed to a package that defines some S4 methods on a base class and relies on that implementation being called on derived classes as well.

Re: Julia 0.2 released

#39

Earlier quoted context omitted.

Fair point, although R's multiple dispatch barely counts as a language feature at all, but is really more of a standard add-on library (read on). All S4 is doing is using a hash table keyed by method signatures to look up which function body to call. You don't even need any syntactic support since "defining a generic function" is just a matter of defining a function that does a hash lookup and then applies that funct…

Thanks for the explanation. What do you mean by "It doesn't support any sort of type hierarchy"? I've contributed to a package that defines some S4 methods on a base class and relies on that implementation being called on derived classes as well.

This may be a misunderstanding on my part because I am by no means an R expert (I've done a fair amount of stats work in R, but no library development). Can you add a method for base class "Foo" which will automatically apply to "Bar" which is a subtype of "Foo"?

Re: Julia 0.2 released

#40
post #33
post #17

How suitable is it to use for mainstream programming (building web app, etc)

Mainstream is a very context specific term. Julia is not a general purpose language, it's primarily for numeric computing. Within the domain of technical computing it's one of the most expressive languages.

I would strongly disagree with this. Julia is a general purpose language. In fact, part of the premise is that it is a numerical computing language because it doesn't special-case numerical programming. This is in stark contrast to Matlab and R, for which numerical things are extremely special-cased.
Post reply on HN