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'm looking for a book that explains functional programming in an accessible manner. Also I would prefer one that isn't too dull, and doesn't use an esoteric language.

Ideally it will use examples that demonstrate situations where functional programming leads to more elegant or simpler solutions than imperative approaches.

I have a reasonable amount of programming experience, but no knowledge of functional programming. Thanks for any suggestions

share|improve this question

closed as not constructive by Mark Trapp Dec 8 '11 at 4:29

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
I'm curious if there was a particular language you had in mind when you said you don't want to use an "esoteric language". –  MatrixFrog Jul 15 '11 at 7:19
    
@MatrixFrog: I'm 99% sure that by "esoteric language", he meant Scheme. He was probably aware that the SICP would be the first book recommended. –  user16764 Jul 15 '11 at 18:25
    
@user16764 But "accessible"? That would be How To Design Programs (or the 2nd ed.) based on the rationale given by the author(s) in The Structure and Interpretation of the Computer Science Curriculum. –  Mark C Jul 26 '11 at 18:06
add comment

7 Answers 7

I would sugest starting with "The Little Schemer" (and perhaps "The Reasoned Schemer" after that).

If you think Scheme is too esoteric, or if you like Javascript, Douglas Crockford has translated many of the exercises into Javascript: http://javascript.crockford.com/little.html

If you enjoy C#, "Real-World Functional Programming" by Tomas Petricek would be an excellent place to start. It also serves as a nice introduction to F#.

share|improve this answer
3  
+1 for Real World Functional Programming –  Jonas Jul 15 '11 at 9:42
    
+1 for Douglas Crockford link. –  zzzzBov Jul 15 '11 at 20:32
add comment

If you like Statically Typed Languages and [Brackets]:

Haskell while rather heavy on purity of programming paradigm, has one of the best introductions to a language I've yet seen in the form of "Learn You a Haskell For Great Good!". Book form is optional as the website is free but this is one author I didn't feel at all underwhelmed by. Real World Haskell is good but really is better taken as a follow up to [Learn..Good]. RWH is also free with optional papery goodness.

From Haskell you can transition easily to other ML variants like F# or OCaml both of which are more widely used. For the bleeding edge ATS.

If you like (and Dynamic_Typing Parentheses) :

Scheme is the more functionally oriented of the two main Lisp dialects, smaller and purer than Common Lisp but less widely used in industry. I personally like The Structure and Interpretation of Computer Programs but it's a fairly theory heavy book, that while a bit hard to swallow will make you a better programmer.

If you'd prefer Common Lisp either Practical Common Lisp or Land of Lisp seem like good investments, the first is free online and the second is fairly cheap and more importantly (for some) game focused. It's more powerful though less pure than Scheme.

From these, you can expand into Clojure if you want. It's Lisp for the JVM so it's easier to deploy and better able to defend against charges of being "academic" Clojure can deploy to .NET and cross over to Javascript too. For native .NET, try IronScheme.

You can also split the difference and learn both sort of at once with Write Yourself a Scheme in 48 Hours in Haskell.

share|improve this answer
    
If you go with SICP there's also lot of video lectures on the book, most famously these: groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures Paul Graham is a good writer and has a free book about why lisp is the bee's knees paulgraham.com/onlisptext.html –  simoraman Jul 15 '11 at 6:18
1  
I'm reading the free online version of Real World Haskell, and the ability to read the comments while reading the text is extremely helpful. So even if you do get the paper version, you might want to read the online version too. Some parts are just way less confusing with the comments. –  MatrixFrog Jul 15 '11 at 7:17
add comment

My favorite source is the Gentle Introduction to Haskell. I read part of Learn you a Haskell and the O'Reilly Real-World Haskell and Simon Thompson's Craft of Functional Programming, but I honestly am doing better w/the gentle intro. It's kind of like Haskell's K&R: a thin document produced by the creators of the language. Not wordy, not patronizing, but not trying to overwhelm you with their erudition, neither.

share|improve this answer
1  
The Gentle Introduction is very direct and no-nonsense, much like a firm punch to the stomach. It is gentle in the sense that it does violence without malice, seeking neither to coddle nor to dominate; rather, in hopes that the reader might come to discover the inner strength necessary to fight back. –  C. A. McCann Jul 15 '11 at 21:34
1  
Hmm, sensei, not sure I'd use that imagery, but whatever. It ain't violent nor is inner strength an issue, but I'll agree w/the rest. "Gentle" is a little humorous here. Like "modest proposal". –  JohnL4 Jul 18 '11 at 15:34
1  
Yes, I was taking some... minor creative liberty there. ;] It does take a bit of mental fortitude, though, to get through something so blunt compared to other introductory material around these days (for any language, not just Haskell). The comparison to K&R makes me think you're used to that sort of style, though. I've generally assumed that "gentle" is meant in contrast to learning from the Haskell Report and a stack of research papers. –  C. A. McCann Jul 18 '11 at 15:44
add comment

http://hop.perl.plover.com/ includes a book that you can download for free. It explains how to use many functional techniques in Perl.

Most of what it says can very easily be translated into JavaScript, Ruby or Python.

share|improve this answer
add comment

I'm currently learning functional programming myself. However I'm learning using Haskell.

Here are a couple of online books (you can also buy these in hardcover iirc)

Haskell isn't esteroic and is becoming more mainstream (possbily not as mainstream as LISP or Erlang). However it is a pure functional language, and will force you to learn the functional programming paradigm. As opposed to a half imperative half functional approach that you will get using a non purely functional language.

People have developed WebServers, Bittorrent Clients and a few real world applications using haskell. However I'm personally using it to learn the concepts and then appling that to C# & F# which is working fantastic so far.

Enjoy.

share|improve this answer
add comment

I heard good things about "Structure and Interpretation of Computer Programs" several times. It's a real book, so you might want to get it in Paper as well, see http://www.amazon.co.uk/Structure-Interpretation-Computer-Electrical-Engineering/dp/0262510871.

It's freely available here http://mitpress.mit.edu/sicp/ ( http://mitpress.mit.edu/sicp/full-text/book/book.html ) and there are even videos of the lectures ( http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/ )

share|improve this answer
    
SICP was nice, but not accessible in my experience. –  willem May 9 at 10:52
add comment

Programming in Haskell

You might not decide to buy it, but the book's homepage (see above) links to 13 channel 9 videos on Haskell programming.

share|improve this answer
add comment

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