Live data from Hacker News

Think Julia: How to Think Like a Computer Scientist

benlauwens.github.io

41–50 of 74 posts

Re: Think Julia: How to Think Like a Computer Scientist

#41
post #17

Earlier quoted context omitted.

> is there a reason to learn Julia? JuMP is why I learned whatever I did of Julia and that was mostly because it allowed me to express some things better (not necessarily faster or in parallel). A good example would be this random problem that came out of an interview discussion. https://gist.github.com/t3rmin4t0r/44d8e09e17495d1c24908fc0f... I'm almost sure my python implementation is wrong, but I can't quite prove…

Using an optimization library seems like the completely wrong approach to solving this interview question. Was that intentional?

Aside from the special case of "1" always being present, I would say that in general you should just use an optimizer to solve knapsack problems. Whether you should do so for an interview question is up for debate I guess; using libraries shows you can get something done quickly and efficiently, but implementing your own solver might show you understand the underlying complexity.

As far as comparing code complexity of Julia to Python is concerned, I would say that when you use JuMP in Julia, you should use Pyomo/CasADi/PuLP/... in Python. That is not to say that I don't find JuMP to be a more appealing framework overall. It has wide support for all kinds of solvers, and some Julia/JuMP authors even wrote fairly good MIQCP/MICP solvers on top of commercial/open-source MILP/SOCP solvers.

Re: Think Julia: How to Think Like a Computer Scientist

#42
post #35

Earlier quoted context omitted.

I've only been learning for about a week, but I think if you're a nerd for language design, you will appreciate it on an aesthetic level as a very tight design around a powerful concept. Common Lisp also has multiple dispatch, but I feel the integration of it into all the nooks and crannies of Julia really pays off. Julia's performance doesn't appear as a side effect of building on the LLVM or because they over-optim…

there's an interesting issue wrt. maths and Juila; yesterday there was a story : https://news.ycombinator.com/item?id=17781475 on unmaintainable code. One of the clauses mentions the use of non standard characters as variable names : δ σ π ρ for example and cites the issue as having to deal with the code in a simple text editor. I recently wrote a simulator intended as the demonstration of some issues in a paper. I f…

This why I love J and APL - succinctness of expression, however, these are very same reasons these PLs are criticized. I think if you do a lot of math with symbols, you appreciate them, and if you are a code maintainer, and not a mathematician, it takes getting used to it.

Re: Think Julia: How to Think Like a Computer Scientist

#43
post #36

Earlier quoted context omitted.

Having spent years working with numpy and Cython, then switching to Scala for years as well, I much prefer dynamic typing. Strong type safety is mostly just a waste of time.

Ohhh… I really disagree; I find that strong typing allows me to get the compiler to check that the work that's going on in the various branches of my code is at least allowed - even if it's wrong. I wish that my test cases really did test all of these corners, but realistically I just don't believe that I am good enough at writing test cases to get everything. From another perspective using strong typing like this sa…

I’ve used a lot of functional programming unit test tools, and I’ve never seen any of them live up to the hype of checking corner cases in an automated yet comprehensive way.

The marketing pitch for that is always something like QuickCheck in Haskell, where e.g. reversing an array should be its own inverse function and you can auto-verify this like it is a law across a bunch of cases.

The problem is in real life unit tests, nothing has any laws like this, and it’s just a bunch of bizarre case-specific business logic and reporting code. The concept of a corner cass is a semantic one, and the definition of what inputs are possible to a given function will change and have constraints from the outside world that not even the most expressive statically typed language will easily let you encode into the type system.

Combine it with the fact that your colleagues have variability in their skills too, and often won’t make good choices with type system abstractions to represent business logic, and then all that costly extra boilerplate code for specifying types, creating your own business-logic-specific ADTs, adding privacy modifiers, templated or type classes implementations...

...it just becomes a big pile of garbage liabilities for what turns out to seriously be no benefits over dynamic typing.

Even in the static typing case, you’ll end up with tons of runtime errors causing you to frequently revisit assumptions in the unit tests. You’ll just have a harder time refactoring large pieces of code that are wedded to particular type designs and you’ll have to sit and wait on the compiler to try every change (this can be hugely bad when the system has components needed for rapid prototyping, interactive data analysis, or other real-time uses).

I’ve really seen a lot of corners of this debate play out in practice, and static typing beyond extremely simple native types and structs (basically C style), really offers nothing while being a huge productivity drain. The claims that it actually helps productivity because the compiler catches errors and forces more correctness just turns out to be false in real code bases. You get just as many weird runtime errors and just have a harder time debugging or rapidly experimenting with changes.

Re: Think Julia: How to Think Like a Computer Scientist

#44
post #11

Earlier quoted context omitted.

Can you explain that last part?

`aurman` is a (unofficial?) package manager for Arch Linux. The standard package manager is called `pacman`. Arch User Repository(AUR) is (IIRC) a repository of uncurated packages compatible with Arch. To put it simply: he is implying that he will check out the book.

Yes, I should have put pacman. The book is a great resource and despite my criticism has introduced me to julia.

Re: Think Julia: How to Think Like a Computer Scientist

#45
post #3

If I don't care about parallelism nor speed, is there a reason to learn Julia?

I don’t use Julia for speed but because it is so easy to use and powerful. Haskell e.g. is very powerful and elegant but time consuming and hard to learn. LISP is easy to learn and powerful but has kind of clunky syntax. Ruby has quite nice syntax and is quite powerful but also kind of messy. Python is quite clean and easy to use but not as powerful. Julia I would say has hit a sweet spot between all these languages.…

Yeah Julia is really easy to pick up if you're a computer science person. I came across Julia when searching for a language with good linear algebra support, then I learned it over a week while implementing a paper I was reading. Two weeks later I implemented an improvement to that paper, which turned out to be very publishable. I basically owe a whole paper to Julia, which almost felt like a free paper lol.

Re: Think Julia: How to Think Like a Computer Scientist

#46
post #9

PSA: The goal of the Julia 1.0 release was to stabilize language constructs for library authors to build upon. It will take time for them to update their libraries to be compatible with v1.0 -- so if you want to get a feel for the language, and things are breaking, stick to v0.7 for the near future.

You probably meant to say "stick with v0.6.4".

Re: Think Julia: How to Think Like a Computer Scientist

#47
post #12

Earlier quoted context omitted.

As somebody who appreciates Julia, my opinion is - probably not. That is, unless you want the opportunity to create a killer library that shows how the language features map well to other domains. But, I think a lot of people in scientific computing are tired of the typeless mess that Python/Numpy/Scipy code-bases evolve to be. And for those people, I think it has a lot of merit. At the end of the day, the language w…

Since you seem to have the same quarrels with MATLAB as me, have you figured out a good way to run it in batch mode, without having to open the interactive console?

Both Matlab and Julia can be run in batch mode, without going to the REPL.

Re: Think Julia: How to Think Like a Computer Scientist

#48
post #12

Earlier quoted context omitted.

As somebody who appreciates Julia, my opinion is - probably not. That is, unless you want the opportunity to create a killer library that shows how the language features map well to other domains. But, I think a lot of people in scientific computing are tired of the typeless mess that Python/Numpy/Scipy code-bases evolve to be. And for those people, I think it has a lot of merit. At the end of the day, the language w…

Since you seem to have the same quarrels with MATLAB as me, have you figured out a good way to run it in batch mode, without having to open the interactive console?

I empathize with you, but I don't have any tips. Any requests to me to make MATLAB part of a distributed computing were given a pretty hard 'no'.

Re: Think Julia: How to Think Like a Computer Scientist

#49
post #18
post #12

Earlier quoted context omitted.

As somebody who appreciates Julia, my opinion is - probably not. That is, unless you want the opportunity to create a killer library that shows how the language features map well to other domains. But, I think a lot of people in scientific computing are tired of the typeless mess that Python/Numpy/Scipy code-bases evolve to be. And for those people, I think it has a lot of merit. At the end of the day, the language w…

What do you mean by production environment in the context of academia / R&D?

There are R&D departments outside of academia.

But in both commercial R&D and academic R&D, some code really needs to live on for future people to benefit from it. It's just not a good use of research time for people to re-write everything from scratch... every time.

Re: Think Julia: How to Think Like a Computer Scientist

#50
post #12

Earlier quoted context omitted.

As somebody who appreciates Julia, my opinion is - probably not. That is, unless you want the opportunity to create a killer library that shows how the language features map well to other domains. But, I think a lot of people in scientific computing are tired of the typeless mess that Python/Numpy/Scipy code-bases evolve to be. And for those people, I think it has a lot of merit. At the end of the day, the language w…

Having spent years working with numpy and Cython, then switching to Scala for years as well, I much prefer dynamic typing. Strong type safety is mostly just a waste of time.

As a long time Python/Cython user I can say that I have sorely missed static types in many occasions, especially for long running tasks. In fact I would sometimes use Cython not for performance but as a type checker.

I can describe a recent example. I had to ensure that an integer is always an int64 as the logic passes through different python modules and libraries. It was an absolute hell to track down all the places where things were dropping down to int32. With static types this would have been a no-brainer. This is not to say that I do not enjoy its dynamic typing where it is appropriate.

Hopefully Python 3 will make things better with optional types. But its still not statically typed, just a pass through a powerful linter.

Post reply on HN