aliquote.org

So many programming languages

January 11, 2011

This is a short overview of several programming languages that I play with when I have some time.

I can remember that my very first programming language was Turbo Pascal; it was an introductory course taught to students enrolled in experimental psychology and the design of psychophysical experiments. Then, I used Matlab a lot during 3 to 4 years. It serves as a statistical package to analyze my data, but it was also a tool to construct visual stimuli and learn basic principles of image and signal processing. I even build a GUI for signal processing and data analysis. During my PhD, I started learning C and Java, while attending a lot of statistical courses. It was also the time I definitively switched to the R statistical package. I learned a little bit of Perl, and then discovered Python, which I mostly used like Bash until recently where I started to use it for some heavy computational statistical tasks.

Now, a lot of more or less “esoteric” languages has emerged, not that they are necessarily very new but since I’m not a true computer scientist I’m not always up to date. Among those languages that I wish I had time to learn more, there are: Ruby, Scala, Haskell, Lua, Clojure, and a lot of stuff around Lisp (clisp, Chicken, CMUCL, SBCL, Clozure CL, Lush).

Scala

The Scala programming language is “a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive.”

Something that I like is that there is a package manager, sbaz, which allows to install additional packages and update the current version of Scala. Also, the documentation sets is impressive. Look for instance at A Scala Tutorial for Java programmers to get a feel of it.

Here is a concise Cheat sheet, and here is a discussion of Scala vs. Clojure: Scala vs Clojure - Round 2: Concurrency!.

Haskell

I discovered Haskell three or four years ago when reading Vincent Zoonekynd’s blog (here). I initially thought it was something to do fun things in mathematics, and never came back to it until recently when I came across this interesting paper on functional programming for information visualization and visual analytics: Beautiful Code, Compelling Evidence, by J. R. Heard. There is a nice illustration with annotated code on the use of circular displays based on OpenGL (that I also discussed in a preceding post).

Since then, I also started using Pandoc, which has now replaced AsciiDoc for writing my notes and tutorials.

Like for Ruby and its Rubiz Quiz, there is an Haskell Quiz for the interested hackers.

Clojure

I’ve started to learn Clojure, because of the rise of Incanter in (part of) the statistical community.

R. Mark Volkmann did a good job at exposing the main ideas of Clojure in Clojure - Functional Programming for the JVM. On a related point, I also like From Lisp to Clojure/Incanter and R, by Shane Conway, because it offers a comparative view of Clojure and R approaches. A lot of other discussions may be found on Stack Overflow. Actually, I’m still in the process of learning the language.

A bunch of free resources on Clojure:

There are actually two books that are worth to look at:

For a quick try, you can jump at Try Clojure. A comparison of Erlang vs Clojure is available on Google Groups. Likewise, there were some Scala vs Clojure discussions.

As for dedicated libraries, I’d like mention the following ones for Machine Learning and data processing:

Groovy

Yet another dynamic programming language that targets the Java Virtual Machine. Following the online description, it is an agile and dynamic language for the Java Virtual Machine; it builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk; it seamlessly integrates with all existing Java classes and libraries; and it compiles straight to Java bytecode so you can use it anywhere you can use Java. I have no experience with it, though.

The famous “Hello World” example with groovy reads:

groovy -e "println 'Hello ' + args[0]" World

h/t @yokofakun

Lua

Well, Lua is a lightweight programming language very useful for automating tasks and interacting with the operating system. According to the documentation, it is robust, fast, portable, embeddable, and powerful yet remaining simple when implementing classes and inheritance. I initially came across this language through Context because the MkIV implementation relies on it, and more generally the LuaTeX engine (but see, e.g, ConTEXt MkIV: Going UTF, by Hans Hagen).

In another post, I described how to install Numeric Lua, which offers some convenient numerical functions, on the Mac.

Some good tutorials to get started with Lua are listed below:

There is also an extensive documentation on Lua website, don’t miss it.

Pure

Pure is “a modern-style functional programming language based on term rewriting. It offers equational definitions with pattern matching, full symbolic rewriting capabilities, dynamic typing, eager and lazy evaluation, lexical closures, built-in list and matrix support and an easy-to-use C interface. The interpreter uses LLVM as a backend to JIT-compile Pure programs to fast native code.”

I didn’t success in compiling and installing Pure. It needs a recent version of LLVM compiler and it seems that the one that ships with OS X doesn’t do the job.

See Also

» Git, svn, Emacs and OVH