views:

1937

answers:

15

I like to study languages outside my comfort zone, but I've had a hard time finding a place to start for functional languages. I heard a lot of good things about Structure and Interpretations of Computer Programs, but when I tried to read through it a couple of years ago it just seemed to whiz over my head. I do way better with books than web sites, but when I visit the local book store the books on LISP look kind of scary.

So what's a good starting point? My goal is to be able to use a functional programming language to solve simple problems in 6 months or so, and the ability to move to more advanced topics, recognize when a functional language is the right tool for the job, and use the language to solve more problems over the course of 2-3 years. I like books that are heavy on examples but also include challenges to work through. Does such a thing exist for functional languages?

+13  A: 

The Little Schemer teaches recursion really well, and it's fun and simple to read.

I also liked The Scheme Programming Language for a broader introduction into the language.

mk
+1  A: 

I found The Little Schemer a great, great introduction to functional programming. It's entirely based on simple, bite sized examples which are built up upon as the book goes on.

Joe Shaw
+1  A: 

Haskell is a very good functional programming language for beginners. Someone had asked about good resources for Haskell, so I will point you there.

If you are looking for a good book on Functional Programming, I would recommend "Functional Programming: Practice and Theory" by Bruce J. Maclennan.
It is however required that you brush up on your Set Theory and Logic before giving it a read. It includes examples in LISP, Haskell and other languages.

Pascal
A: 

If you have experience with .NET, Expert #F is good.

F# is derived from OCaml. Lisp is more pure as functional languages go.

Brian Leahy
I don't think I'd consider Lisp as more pure than OCaml. Most Lisps do nothing to prevent you from mutation. OCaml on the other hand makes it impossible to mutate variables unless you declare them as mutable.
Andrew Gwozdziewycz
+4  A: 

SICP is a great book.

This is probably my bias, but I thought ocaml was pretty easy to get into. You have the option of programming in a few different styles until you're completely comfortable. Along those lines, I'd recommend python as well. Though, ocaml will get you closer to the syntax of Haskell, and similar functional languages. F# is another option, I've looked at the code and I can never tell if it is ocaml or not --the comments are a dead giveaway, if present.

I posted a bunch of links to Haskell and Ocaml references that are books, with examples et cetera that seem right up your alley.

If you prefer Lisp, you can try to power through the 99-problems in Lisp(which you can do in any language, really), or you can watch the lectures from the people who wrote SICP.

Further down the road, get a hold of "Purely Functional Data Structures", as it'll get into the hard-core deep design and considerations you have to take into account in functional languages --it uses ML (which ocaml derived from).

nlucaroni
I'm reading SICP now, but I'm not sure what you're talking about re: "the Lagrange"? In my paperback copy of the 2nd Ed the only reference to Lagrange in the index is this footnote on Lagrange interpolation: http://www-mitpress.mit.edu/sicp/full-text/book/book-Z-H-18.html#footnote_Temp_299
spacemanaki
That parts was referring to SICM (Structure and Interpretation of Classical Mechanics), my mistake.
nlucaroni
A: 

I have heard good things about Haskell Functional Programming, but I also found this list of functional programming books at amazon that might be helpful to you.

Craig H
+3  A: 

I really like Thompson’s “Haskell: The Craft of Functional Programming” because it’s well written and Haskell allows an easier start than other functional languages while being completely pure (unlike Lisp or Scheme).

Konrad Rudolph
+1, The book has a lot of excellent exercises as well since its written primarily as a text book. The explanations and narrative also make the book a good choice.
+3  A: 

Since there are a bunch of different functional programming languages, it's hard to recommend books. But if you're interested in Common Lisp, recently I've been reading "Practical Common Lisp" by Peter Seibel, which you can check out online for free before dropping your hard earned cash on it. It's a pretty gentle introduction to CL, with great explanations and tons of examples. Seibel's a great writer (example: read the story of Mac,) he's good at keeping you engaged, which is really where SICP falls down, I think. It's just so dry! But while Practical Common Lisp is pretty example-heavy, it doesn't really have challenges to work through, although the examples are mostly designed to let you continue to work and build on them.

Another good book, this one Scheme-oriented: How to Design Programs. (Online) I haven't had as much time with this book, being more of a Lisper than a Schemer myself, but it's well written, has good explanations and examples, and has lots of exercises to work on. It seems pretty popular in the Scheme crowd.

jrdn
+3  A: 

I learned from Jeffrey Ullman's Elements of ML Programming, which is pretty good. It loses points for being about Standard ML, when OCaml, F#, and Haskell are (seemingly) more popular.

Chris Conway
+13  A: 

Try Real World Haskell. It's free online.

John
+2  A: 

The Schemers Guide and related software - seriously good stuff

http://www.schemers.com/tsg.html

+1  A: 

I feel Purely Functional Data Structures by Chris Okasaki is worth a look.

FYI http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf

Stephen
+4  A: 

I really recommend "On Lisp" from Paul Graham.

It is concise and very readable even for beginners in functional programming (as I was when I read it). It contains a lot of very short examples, each which helps to understand one single thing.

I often thought reading this book: this is just the language containing exactly the features I ever wanted in other (nonfunctional) languages, but never got. :-( And this is exactly the book to learn it, always comprehensible, sometimes even funny!

You may get it for free at the author's site!

thecivil
+1  A: 

Check out Introduction to functional programming. It offers a different perspective.

A: 

Real-World Functional Programming (with examples in F# and C#)

Mauricio Scheffer