views:

1624

answers:

4

Hi I'd like to pick up one FP language (it's always a pain when you work in a position that does not require you learn much), and after doing some research, I felt Erlang and OCaml are the two that I'd really like to get my feet wet for the following reasons:

1) I work mainly on high-availability web server back-end system in C++. I heard Erlang is a great fix in scalability and fault-tolerance. Though I don't think my current company will have any project in Erlang, I feel Erlang may be a good language for my long term career development.

2) I have a co-worker who is really good at OCaml, I mean he is really good at it (but he does not work on that for his daily work now. He maintains several library). So I figured that he may be a good resource if I learn OCaml.

My interests are mainly on distributed systems (my current work is some midldle-ware development work) and high-performance computing (guess what, I had a couple of years graduate school research on it, in particular PDE in Financial applications -- so I always felt I may go back to do some finance modeling work maybe sometime later)

Any suggestions? Please don't suggest "learn both", as I am not that smart :-)

Thanks

+4  A: 

Ocaml is a great language -- one of my favorites -- but if your interest is distributed systems than I'd recommend going with Erlang, which is head and shoulders ahead of the other FP languages with regards to distributed systems (although there's an offshoot of Ocaml called Jocaml which has some interesting aspects).

Ocaml is weaker even when just looking at parallelism, given its underlying architecture. Both Haskell and Clojure have better stories here, imho. (That said: once you get one FP language, you'll be able to carry the fundamental principles to other languages pretty easily, and they might be useful in the future. Both Scala and Clojure could easily sneak their way into organizations by virtue of the JVM.)

brool
+1  A: 

I would also consider to look at F# (especially when VS 2010 is out). Learning a new language is a lot easier and more convenient with a nice IDE. F# and OCaml are very similar as you can see in other SO threads (e.g. here)

weismat
+3  A: 

If you have a co-worker who is "really good" with OCaml then it sounds like you have a great resource assuming that s/he is willing to answer your questions. It's always easier to learn when there's someone knowledgeable around that you can ask questions of if you get stuck.

Yes it's true that OCaml doesn't have the best story when it comes to parallelism, but there are ways to get parallelism in OCaml (fork-based seems to be the most common - checkout prelude.ml which includes things like parallel map: http://github.com/kig/preludeml/tree/master ). Also, it seems that Erlang's Actor-based concurrency is really fairly easy to duplicate in other languages. Maybe you and your co-worker could work on a project to develop an Actor-based concurrency library for OCaml? That would give you a nice learning project that you co-worker would probably find interesting enough to work on with you... in addition you could end up creating something useful for the entire OCaml community.

aneccodeal
+2  A: 

I think Ocaml is a great way to get started in FP, and Erlang is not very difficult once you have the basic FP concepts down.

But the suggestion from 'aneccodeal' is fantastic-- i.e., if you are interested in Ocaml and have a friend who is already strong in it, by all means develop a concurrency (perhaps MPI) library for it.

Keep in mind, however, that one of the barriers to making Ocaml concurrent is the lack of concurrent garbage collection (or so I have read).