Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I currently code with C, C++, and Python. I'm wanting to pick up a functional programming language, and right now I'm leaning toward Haskell. I do NOT want to start a "Haskell vs Lisp" war here; what I want to know is this: if I learn Haskell primarily for exposure to functional programming, what benefits, if any, will I gain from later learning Lisp?


Update: Thanks everyone for your answers. Now all I need to do is pick a dialect of Lisp, but that's a question for another time.

share|improve this question
    
And F# and Clojure. –  Heather Feb 13 '12 at 11:45

6 Answers 6

up vote 46 down vote accepted

I suggest learning both, Haskell first, then Common Lisp. My experience with Haskell was that the static typing seemed to be a restricting annoyance at first, but once I got used to it, I noticed that most of my type errors had logic errors hiding behind them. When you get to this point, and the next milestone, which is learning to think in types and define your own types as a means of expressing your solution, you'll be ready for Common Lisp.

With Common Lisp, you can add monads, currying, and everything you liked from Haskell, but you also get multiple inheritance like Frank Shearar mentioned, and generic functions with multiple dispatch, and an advanced exception handling system.

So why not just learn Common Lisp first? Coming from a procedural and OOP background, my experience has been that I didn't really understand functional programming until I had to use it exclusively. Once functional programming is comfortable, you can add the rest of the tools that Common Lisp makes available, and use whatever tool is best at the task at hand.

share|improve this answer
6  
I think you nailed it - what makes Haskell and Smalltalk so useful for learning is their purity. –  Frank Shearar Nov 14 '10 at 11:44
2  
I agree with the purity makes learning a language a lot easier. I couldn't understand functional language itself with LISP because everything are possible in the language and I have too much imperative, OO background. But in Haskell, there is no such concepts which disrupt learning. –  Eonil Feb 16 '11 at 2:09
1  
It's funny, I've had the opposite experience. I picked up the main points of functional programming through Scheme, my first language. I occasionally hack in Haskell and I inevitably find that I have to relearn 90%+ of the stuff that I knew whenever I leave Haskell for a while. That being said, Haskell is an incredibly rich language, with a huge amount to teach you (very forcibly.) Types Types Types Types! Follow the types! –  Josh Infiesto Apr 1 '12 at 4:59

AND please.

Haskell teaches you the purest of FP, as far as I'm aware at least, just like Smalltalk teaches the purest of OO. (I mention this not to suggest that OO and FP can't marry, but because both these languages are "gem" languages - a core idea taken to extremes.)

Lisp is really a family of languages, so I'll talk about Common Lisp because that's the particular member of the family I use.

Lisp will still have lots to teach you:

  • It's multiparadigm, so as dsimcha points out it'll show you how to integrate FP with other paradigms.
  • Lisp will teach you that "code-is-data, data-is-code", for example through its macros.
  • CLOS is a very interesting brand of OO, with multiple inheritance that works, and generic functions.
share|improve this answer

Learning Lisp later will allow you to customize Emacs which arguably is the most advanced text editor available. You can't do that in Haskell.

share|improve this answer
9  
[Sharpens his parentheses] –  Inaimathi Nov 13 '10 at 20:35
5  
Maybe someone can write a text editor for it. I hear the Emacs operating system doesn't come with one. (I kid. I know you can get Viper mode. :) –  greyfade Nov 13 '10 at 23:04
10  
Actually, there is an Emacs-clone called Yi, which uses Haskell in exactly the same way as Emacs uses Lisp. In fact, compared to (GNU) Emacs, Yi is even purer, because its kernel is also written in Haskell, whereas Emacs kernels generally tend not to be written in Lisp. GNU Emacs' kernel is written in C, JEmacs' is written in Java, for example. –  Jörg W Mittag Nov 13 '10 at 23:09
2  
@Jörg, if it is a partial reimplementation instead of a full clone of GNU Emacs or XEmacs, it is not the same thing. Similar to comparing Word to Wordpad or Notepad. –  user1249 Nov 13 '10 at 23:26
1  
@Thorbjørn Ravn Andersen: Yes, but not quite that bad. :) –  greyfade Nov 14 '10 at 4:27

Haskell and Lisp are two totally different beasts.

Haskell is kindof "pure functional programming in an ivory tower"

Lisp is kindof "code-is-data / data-is-code / make your own language constructs". You can manipulate your code in whatever way you can imagine.

They are very different. Both share the "functional programming" aspect, but that's really a tiny little common point compared to their differences. Just try them out and you will see how different they are!

share|improve this answer
    
+1: Good point. I know some Haskell and some Lisp. Even though I am not an expert in either of them, I think you are right that they are very different. In Haskell you do not have the idea of using data as code. In Lisp you do not have (AFAIK) pattern matching. Probably the list (!) of differences is longer. –  Giorgio Jul 3 '12 at 5:35

The main benefit I see from learning Lisp is learning how to integrate FP into a real-world oriented multiparadigm language, rather than only learning it in the context of an academic language that emphasizes purity.

share|improve this answer
5  
I guess you do want a "Haskell vs Lisp" war! –  Don Roby Nov 13 '10 at 17:59
3  
Haskell is an academic language that emphasises purity... and lots of people use it in the real world. Smalltalk's in that camp too. –  Frank Shearar Nov 13 '10 at 18:06
    
Lots of people use Haskell in the real world? –  Jon Harrop Dec 27 '10 at 19:28
1  
@Jon Harrop: Well, I do use Haskell in the real world (and it works really fine for certain applications), maybe I am one of the few (?) –  Giorgio Aug 2 '12 at 8:38

I also come from a C/C++/Python background and have tried out FP a couple of times in the last few years. Initially I looked at Haskell and couldn't make head or tail of it, then tried Ocaml but didn't get much further with that. Finally I started hearing good things about Scala, tried it, and found it suited me very well (I had also done a bit of Java in the past), to the point that after a year of so of dabbling in Scala (and dispatching 161 Project Euler problems with it), Haskell seems to make much more sense. In fact I just ordered a couple of books on Haskell and want to give it another go, although this is largely motivated by the existence of Scalaz.

So I found using a multi-paradigm language (ie Scala, but Lisp would probably fit the bill too) a good way into FP. But if you're happy diving into Haskell (I wasn't), go for it.

share|improve this answer
    
Interesting that you got further with Scala than OCaml. How come? –  Jon Harrop Dec 27 '10 at 19:32
    
@Jon: Good question; hard to say. Maybe I just wasn't ready to "get into" functional at the time. Maybe I just happened to find a Scala tutorial pitched at the right level. Maybe Scala's C/C++/Java lineage just made it a bit less alien. Given any rational bet these days would be on F# rather than Scala, I'll probably revisit the OCaml domain at some point, although since I dabble in this stuff just for the sheer joy of getting into a different "programming mindset" to my C++ dayjob, I have a perverse inclination to retry Haskell again next. –  timday Dec 27 '10 at 20:37
    
Smooth moving approach :) –  Eonil Feb 16 '11 at 2:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.