Code and comments

Practical and theoretical aspects of software development

Don’t forget Erlang

with 3 comments

Everyone should learn to think functionally and recursively. But how? With which language? I think that one of the best options for functional programming is largely overlooked …

Lisp

At some point in your computer science education you were probably exposed to Lisp. Perhaps you worked through part of the SICP book, or maybe The Little Schemer. If not, I highly recommend the latter.

But most of us get tired of Lisp. Even though it has been used very effectively in cases, it feels like a trick, an academic ploy to unsettle our previous convictions about programming languages.

Haskell

If you are still interested in functional languages, you are likely to try Haskell next. (Probably starting with Learn You A Haskell.) Haskell has enough syntax to feel like a real language, and if (like me) you have a background in mathematics, it is loads of fun. I spent some time working Project Euler problems in Haskell (here), and it felt like cheating. Once a problem is solved mathematically, it isn’t much trouble to translate it to Haskell.

Haskell isn’t just for mathematics, of course. It is a great place to learn to think functionally, and to gain comfort with recursion and functional concepts like map, filter, and fold.

But Haskell wore me out in the end. The quest for functional purity has lead Haskell to an impractical place, which was never more clear to me than the day that I spent several hours studying monads so that I could read from a text file. It was that day that I was convinced that Haskell would never be relevant in industry.

Erlang

Recently I started learning Erlang on a whim, using Learn You Some Erlang. It’s my favorite so far. It’s not painful to read, like Lisp. And I don’t have to worry about types and monads, like in Haskell. You are required to think functionally, as you cannot change the state of a variable … but Erlang doesn’t worry about purity, which is refreshing.

Erlang is clearly not my first functional language, but I think that it would be an excellent choice as such. It lacks the most intimidating aspects of Lisp and Haskell, but without allowing for procedural code. And as a bonus, Erlang has some sort of super-awesome concurrency model that is extremely parallelizable. I don’t know anything about this yet, but I’m looking forward to learning about it.

Advertisements

Written by Eric Wilson

September 5, 2012 at 6:25 am

Posted in commentary

Tagged with , , , , ,

3 Responses

Subscribe to comments with RSS.

  1. You can try F#, it starts with OCaml, which is to say SML with object extensions, which is to say Haskel without the lazy evaluation, and then it adds practical stuff like the .net libraries, and a modern development environment. Admittedly it is most compatible with MS, which is not my first choice.

    I’ve been meaning to try Scala which is Java based and has Eclipse as a development environment.

    John M. Hunt

    September 5, 2012 at 10:18 am

    • Scala is next on my list. F# sounds interesting, but I currently have no connection to the MicroSoft world, and no real reason to want to. But many of my Java friends are enthusiastic about Scala, though I’ve heard mixed reviews for the support from Eclipse.

      Eric Wilson

      September 5, 2012 at 12:04 pm

  2. […] Don’t forget Erlang ::: Code and comments […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: