Live data from Hacker News

Why Julia

ucidatascienceinitiative.github.io

121–130 of 257 posts

Re: Why Julia

#121
post #114

Earlier quoted context omitted.

I don't argue that R is not insane ;-) As for (a bunch of) functions in the basic library (which, essentially, is a set of packages that you can discard or simply not use), I dare say it has little to do with the language itself. I don't like Python's regular expressions library, for example, but it's only a set of functions (or methods) that you can write on your own! The same goes for R's data-wrangling routines; t…

> there's this tidyverse, and you can write good, reliable, production-grade code without using a single function from the base library A different take on the subject ( https://r4stats.com/2017/03/23/the-tidyverse-curse/ ): > On the other hand side – I have met a guy using R in production. And he told me that he needs code that stayed the same for 5+ years. That is why he does not use dplyr or any tidyverse, it is s…

That's right! And I always keep telling my peers that they should think twice before they decide to use tidyverse packages in the production code. What I meant is that in R you always have choice - and even if you feel that the existing solutions don't meet your expectations, you can always write your own (even if it means writing a DSL like Hadley et al. did in ggplot2 or rlang).

Re: Why Julia

#122
post #112

Earlier quoted context omitted.

All fair enough but not particularly relevant here (in the context of "why Swift"). For doing numeric work in a language actually defined for that purpose, you will have proper 2D (and hopefully n-D) arrays, and hopefully slicing operations on them. So you'll never do this. In this context doing 2D indexing in 1D arrays is a code smell. It does come up in the case of writing libraries for general purpose language wit…

Well, the nice thing about doing 2d indexing in 1d arrays is the 1d array sits in one contiguous block of memory, which can be important for performance, and also makes it a lot easier to pass the array to C libraries (which I think you alluded to). Whereas in a lot of languages, int[3][3] might be stored as 3 pointers to 3 arrays. I imagine Julia optimizes this?

Yes, in julia A = rand(2,2) is a matrix, and reshape(A,:) is a vector view of the same continuous block of memory. You may also index A[i] directly, as if it were a vector; eachindex(A) is an iterator which uses whichever style of indexing is going to be quickest (and in cache-friendly order).

Re: Why Julia

#123
post #106

Earlier quoted context omitted.

I might be wrong, but my understanding is things happened backwards from that. OOP tried to solve the problem of how to get tons of devs working on huge projects at the same time; java came along to try to be an awesome OOP environment, so Java became the standard.

> OOP tried to solve the problem of how to get tons of devs working on huge projects at the same time I am skeptical of that history. Simula and smalltalk were academic endeavors long before lots of devs were working on projects, Java became popular because it was a portable C++ which had no pointers and garbage collection.

Smalltalk was being adopted across the industry when Java came around, the big difference was that JDK was free beer and one of the big Smalltakers (IBM) rebooted their environment into Eclipse, while jumping into Java bandwagon.

Re: Why Julia

#124
post #20

Earlier quoted context omitted.

This was written back in Julia v0.5, and the compiler got smarter so I need to update my examples :). Here, Julia specializes now on the fact that `-5` is a literal, and then inlines the literal and corrects the output type using that value. If you define it as a variable and stop constant propogation, it'll error. Stuff like this are making it harder to write tutorials to show what's actually going on, because liter…

Ah, well, I guess that's good news then!

As a rule of thumb, it is probably a good idea to ignore Julia articles that are more than a year or so old. Anything that is discussing pre-1.0 may be completely irrelevant at this point. The language has evolved a lot, even the past few years, and it is only with the 1.0 release last fall that the devs promised to start maintaining backwards compatibility.

So there are lots of older articles discussing drawbacks to Julia, or ways to do things in Julia, that simply aren’t relevant anymore. Unfortunately they still often are the first links that come up when searching google for Julia questions.

Re: Why Julia

#125

As someone who has never run into performance problems with R, and also knows how to use Python - is there a good reason to learn Julia?

Last week I compared a standard regression command across several statistical programs (R, Py, Stata, Matlab, Julia, etc) on a stupidly simple 10x5 matrix, and Julia took ages to run (this is on windows). Even loading the CSV file took seconds in Julia, hundreds of times slower than all of the other packages put together. I'm not sure if they just suck at Windows, but I was extremely dissapointed... :/

Probably it took ages for the first invocation. Because that is when the compiler has to produce native code. The compiled codes then is super fast. Just invoke it a second time (in the REPL) to see the difference.

Re: Why Julia

#126
post #58
post #54

Earlier quoted context omitted.

To be fair, though, this behaviour (namely, staying close to machine arithmetic) has been discussed and decided upon, and advertised. It's what enables the speed. C/C++ makes the same choices, by and large.

I don't think C/C++ have integer exponentiation so even C/C++ programmers may be surprised here. I don't know if the behaviour of the power operator when both numbers are integers (and depending on whether the exponent is negative or positive) is mentioned in the documentation.

This is something that was just heavily discussed on the Julia Discourse, with a big back and forth between individuals used to the computer integer arithmetic rules vs people wanting Python like functionality.

Based on the confusion there, it definitely seems that it could be made clearer in the docs that if one wants floating point results one needs to use 10.0^17 instead of 10^17.

Re: Why Julia

#127

Earlier quoted context omitted.

Of course! Once I realize that after a few seconds only a dozen images have been processed I cut the loop, remember that the julia repl is dog slow, and then, rewrite the task in a different way. But I would prefer not to have to do that. Moreover, for more complicated examples, there may be data dependencies that make the loop commutation non trivial. The slow startup time may be a minor inconvenience, I agree. But…

You have to use it inside a REPL, like R or Matlab. Julia using LLVM and compiling on-the-fly is not sloppy design, it's a design tradeoff (and a great one, if you really need speed). Julia is not a scripting language, it's a language for mathematical analysis. Also going back to your example the solution would be to use ImageMagick.jl from Julia, and extend the library (4 extra lines with ccall) if it's not availabl…

> Julia is not a scripting language, it's a language for mathematical analysis.

Ok, this clarifies the matter a lot. So julia is not intended to be a general-purpose programming language. Are you involved in julia development?

(Besides, I strongly dislike the design tradeoff of not being a good unix citizen.)

Re: Why Julia

#128

I want to like Julia but after a decade of Python, every time I try it, it’s a death by a thousand cuts (and outdated Google results). I just can’t afford to have productivity drop to near zero for the learning curve plus reimplement everything. Also I ha e found multiple dispatch to be harder than regular OO methods to locate (for IDEs but grep also).

When I search Julia questions on Google I always restrict the search to the past year or six months. You are right that there is an enormous amount of irrelevant info out there from earlier versions of the language.

Re: Why Julia

#129
post #70

Earlier quoted context omitted.

This is something I don't fundamentally understand. As someone who works a lot with MATLAB I'm very used to and like 1-based indexing. But when I use C or Python, 0-based indexing is not something I complain about or hold against the language. It's just the way things are. Maybe if you don't think of it in terms of a different index basis and instead you think of it as indexing vs. offsets then it becomes easier to s…

If that's someone's biggest complaint against the language, then I'd say the language must be pretty awesome ;-) It's basically bikeshedding. "But I look at the shed all day..." "But I'm used to looking at reddish colors..." "Red is more correct than green because ..." Let's all move on to more important things :-)

It's not bikeshedding because: 1) it is pervasive and fairly importsnt 2) it's kind of a deep indication that something is amiss. It's like a language written in 2019 that has default dynamic not lexical binding, not in terms of importance but in terms of it's an argument that was had and decided 20 years ago. If this is wrong then you can probably assume that lots of other things which are important, decisions which can't be "proven" correct but have both convincing arguments and weighty empirical evidence are wrong (I'm not having that argument here but google why 0-based makes sense by Djikstra).

I might have to learn Julia at some point but 1-based indexing was a fairly heavy indicator to me to hold off.

Re: Why Julia

#130
post #58

Earlier quoted context omitted.

I don't think C/C++ have integer exponentiation so even C/C++ programmers may be surprised here. I don't know if the behaviour of the power operator when both numbers are integers (and depending on whether the exponent is negative or positive) is mentioned in the documentation.

This is something that was just heavily discussed on the Julia Discourse, with a big back and forth between individuals used to the computer integer arithmetic rules vs people wanting Python like functionality. Based on the confusion there, it definitely seems that it could be made clearer in the docs that if one wants floating point results one needs to use 10.0^17 instead of 10^17.

[deleted]
Post reply on HN