First Thoughts on Julia

I’ve been coding the Countdown Numbers game that we designed several days ago in the Julia language this afternoon and evening. So far, I’ve implemented the number selection and target selection functions. I’m currently working on the code that generates potential solutions and evaluates them using the criteria established in the definition of the game.

I am using the Juno development environment. It is developed as a plugin for the Atom editor. So far the only criticism I have of it is that it is a little overly aggressive with suggestions for autocompletion. There is probably a configuration option to tone down the aggression but I was so eager to start coding that I haven’t taken time to read the Juno tutorial.

My first impressions of Julia are very favorable. It seems to adopt the best features of a bunch of the best dynamic languages while managing to avoid feeling like a hodgepodge of features. It is built with the best of current compiler technology and consequently delivers a very performant end product.

Several of its features in particular impress me. First and foremost, it is homoiconic, that is to say, the compiled objects in the language are expressed as data elements of the language and as such lend themselves to dynamic manipulation. This supports the second impressive feature, it supports a full blown, Lisp like macro language. Macros allow you to easily extend the syntax of the language. You don’t need them often but when you do, they can turn writing and maintaining a complex code base into a walk in the park.

It also has full blown multiple dispatch, which is to say, you can have a function that has separate implementations depending on the types of arguments that you pass into it. For example, you might have a function that computes the area of a rectangle. If you passed in parameters of type inches you would be dispatched to a function that computed the area of a rectangle in inches from the height and width of the rectangle in inches. Or, if you passed in one parameter in inches and the other parameter in millimeters, it would be dispatched to another function that converted the parameters in millimeters to inches and then called the original function to compute the area in inches.

Behind most of these features is a type system that helps insure your computations make sense without burdening you with declaring variables, particular when the  compiler can infer what they are from context without your explicit intervention.

The last thing I’ll say tonight about Julia is that the code just looks clean. There is no extraneous boilerplate that tends to clutter up many other languages (cough cough java cough cough).

As promised in the blog post where we designed the Countdown Numbers game, I will walk you through the implementation of it when I get it written. I’ll also discuss why I made tweaks to the design while implementing it.

Go download Julia and have a look at the manual that is available there. It is a good place to start.  If you are impatient, Learn Julia in a few minutes is a good way to get up to speed fast, especially if you have written any Python or Ruby code.

Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.