Those of you who have been following my blog for any time at all have probably noticed that I tend to write mainly about programming languages, with a recent concentration on Lisp. I love programming languages, I think that goes without saying–although, I’ve just said it anyway–and I tend to like dynamic (or agile) languages that allow me to concentrate on the problem I want to solve rather than the intricacies of things like variable typing and memory management. For these reasons I have tended to use Python for most of my non-work-related work (or hobbyist type work and school) and I have recently been learning, using, and enjoying Lisp as an alternative. In fact, many times I have found myself falling back on Lisp when I’ve run into a problem using Python rather than the other way around. It is this new found love for Lisp that has got me wondering what other functional programming languages are out there. In my searches I have come across two candidates for the language I am hoping to learn next–OCaml and Haskell.

I first started playing around with Haskell, mainly because it is the only truly pure functional language that I know of and I really liked some of its features, such as pattern matching and curried functions, but after trying to wrap my brain around it (so far, not completely successfully), I am finding that it’s hard to do everything I want to do with Haskell. Plus, it has been slow in a few areas (probably mostly due to my ineptitude, but still, I’ve been holding out for that holy grail of a language that lets me use recursion significantly in my code with almost no performance hits). All of this led me to look into OCaml. OCaml seems to me like a gentle introduction to Haskell. It has some of the same features, but also includes support for more familiar programming paradigms (i.e., imperative and OO). Also, OCaml seems to knock the socks off of just about any other language outside of C when it comes to performance comparisons–a very good thing since much of my school work/research makes use of some extremely time consuming code.

All in all, both languages seem to have several advantages/disadvantages that make me look at each for a few days and then go running back to the other looking for solace. I prefer Haskell’s syntax to OCaml’s and I love that Haskell is purely functional, but I am finding that the purely functional aspects are making it tough to do certain things (e.g., quite a few of the algorithms in my Bioinformatics class use Dynamic Programming. I have no idea how this would be done in Haskell and I’ve tried the recursive way of doing things and it is just way too slow). I also hate that I can’t declare a function in Hugs or GHC’s interactive shell without doing some really kludgy tricks.

As for OCaml, I do like that I can use imperative features, this would make OCaml a better candidate for everyday use since I could more easily use it for scripting and quick tasks. It seems to have a larger set of libraries as well. All of this would seem to point to OCaml as the better choice for a language I could use for more than just academic tasks. However, I still have gripes with OCaml as well–namely, syntax. I much prefer the syntax of Haskell to OCaml. I like Haskell’s pattern matching syntax more than OCaml’s, I absolutely hate the double semi-colon (;;) that is used as an end-of-line marker, and I don’t particularly like that I have to explicitly state that a function is recursive in OCaml.

All of that said, we get to real point of this post. Basically, I really want to learn another language that moves me even more into the functional programming paradigm. I’ve enjoyed what Lisp has to offer and it has made me much more appreciative of the power of the functional paradigm, but, frankly, I find myself wanting even more. Because of this desire, I am asking you–my readers, wanderers, visitor’s–regardless of how it is you have happened by this blog post, I am leaving it up to you to point out to me the benefits and deficiencies of each of these languages. I am hoping that after reading each of your comments that I will have a clearer picture of the purpose of each of these two languages and I can go about making my choice for the next programming language I am going to learn. So, please, if you have had any experience in either language–good or bad–make a comment below and give me the insight I need to make the best choice for my next language.

Thank you all very much in advance for your comments–they are, as always, very much appreciated.