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.

Possible Duplicate:
How to grasp functional programming concepts?

I'm looking for some resources on functional programming subject. It seems to be a paradigm which is gaining visibility and I wanna know a bit more of it.

What are the books/ebooks/articles do you recommend?

Note: I'm not necessarily looking for a specific language, but for the paradigm itself.

share|improve this question

marked as duplicate by Mark Trapp Dec 11 '11 at 18:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
You should be learning the paradigm through a language, I guess –  Mahmoud Hossam Mar 8 '11 at 16:04
    
@Mahmoud yeah, what I meant was I'm not looking for a functional language tutorial/ebook, however I wanna use a language as a tool for better theory understanding :-) –  Herberth Amaral Mar 8 '11 at 16:07
1  
I found real world haskell helpful. –  dan_waterworth Mar 8 '11 at 18:46
    
Shameless plug: Functional Programming in OCaml focused on functional programming rather than OCaml, but in the final lectures using imperative features and the module system when necessary. –  lukstafi Jun 18 '13 at 11:25

9 Answers 9

up vote 4 down vote accepted

The best answer is really going to depend on what languages you currently know. If you're familiar with the C-family, in particular C#, then learning F# would probably be most practical. You'll pick up all the fundamentals of functional programming, but be able to blend in OOP concepts (like in OCAML). Plus, you can back port most of that knowledge into C# itself to do minor functional programming in an OOP language.

A good book for this method would be Real World Functional Programming by Tomas Petricek with Jon Skeet. EDIT: Its a good book because it goes over the principles of FP, but shows how to use them in both a Functional language (F#) and an OOP language (C#) so you gain an understanding of not just what to do and why, but also how the computer is really interpreting what you're doing. I think that's always valuable in programming.

On the other hand, you may want a pure approach, in which case I recommend Haskell. Its harder to get started with, but will give you the cleanest and most comprehensive approach to learning just FP concepts.

share|improve this answer
    
Good, seems to be a good resource for learning FP... the examples inside the book will be very helpful. I'll see the table of contents. Thanks in advance! –  Herberth Amaral Mar 8 '11 at 18:32
    
F# is not like OCaml. Even though you can write simple programs that compile under both. –  lukstafi Jun 18 '13 at 11:23

What can I say besides: Learn You a Haskell for Greater Good!

the funkiest way to learn Haskell, which is the best functional programming language around. You may have heard of it. This guide is meant for people who have programmed already, but have yet to try functional programming.

The whole thing is completely free to read online, but it's also available in print...

share|improve this answer
1  
eh, I don't really think that's very good. –  Paul Nathan Mar 8 '11 at 20:46
2  
@Paul Nathan Why? I enjoyed it greatly, that's why I recommended it. It would be interesting to hear what you didn't like about it instead of just "I don't really think that's very good". –  Vitor Mar 8 '11 at 20:48
1  
it's sort of useful in a hand-holding way or to check a given syntax in haskell. I have not found it remotely useful to engage me in how to think in a pure functional fashion (or for that matter, how to wrap my head around the type system). –  Paul Nathan Mar 8 '11 at 21:02
    
@gnat this question is over 2 years old with more than 10 upvotes, I feel like it can be left alone. –  jozefg Jun 17 '13 at 4:38
    
@PaulNathan Disagreed. LYAHFGG is an awesome resource for beginners to functional programming. It certainly helped me, and I knew nothing about Haskell's type system. It's not enough for advanced users, but that's not its purpose. Real World Haskell might be better for that. –  Andres F. Jun 18 '13 at 18:56

The concept behind functional programming is called "lambda calculus".

The canonical and the most comprehensive book on lambda calculus is Barendregt, H. P. "The Lambda Calculus: Its Syntax and Semantics."

share|improve this answer

The Charming Python: Functional programming in Python from IBM Developerworks really helped me to understand what functional programming is.

This article is for Python, but I think the code examples in this article (in which doing different things functionally and procedurally are contrasted) can clarify the difference between procedural and functional programming for any programming language.

share|improve this answer

The Little Schemer Trilogy is a great resource for learning the basics. Most Lispers I've met actually recommend going through the first one, then moving on to On Lisp (which is available for free at the authors' site).

share|improve this answer

People here have been recommending Scheme and specifically this course as an intro to procedural/functional programming.

I didn't follow the whole course, but I really learned a few things even though I just watched the first video.


If you find SICP hard to follow, you can also learn Scheme using this book.

share|improve this answer
2  
You mention SICP, but you might also want to point out the Little Schemer Trilogy, which is excellent for beginners to functional programming. –  Inaimathi Mar 8 '11 at 16:57
    
@Inaimathi you can put it in a new answer :) you'll get more rep for that –  Mahmoud Hossam Mar 8 '11 at 17:02

I have been working through the following book: http://www.amazon.co.uk/Real-World-Functional-Programming-Examples/dp/1933988924/ref=sr_1_1?ie=UTF8&qid=1299602802&sr=8-1

The examples are in F# and C# so they might be a bit too Microsoft centric for your needs. I can recommend the book though; I am slowly beginning to 'think functionally' about certain problems.

share|improve this answer
    
I work with Microsoft technology, so it won't be "too centric". Also, there is mono ;-) –  Herberth Amaral Mar 8 '11 at 18:34

Why don't you write yourself a Scheme using Haskell.

Learn two functional languages at the same time!

48 hours is probably a bit optimistic as you would want to read around and play with the concepts to make sure you fully understand whats going on before proceeding on..

share|improve this answer
    
IMO, this is most useful for Schemers who want to get into Haskell (or perhaps Haskellers who want into Scheme). I doubt someone who knew neither language would benefit much. It is a great exercise to go through though. –  Inaimathi Mar 8 '11 at 16:55
    
This is good. I've learned a bit of LISP, so learning Scheme and Haskell will be a great experience. Thank you. –  Herberth Amaral Mar 8 '11 at 18:35

In reference to Vitor's response Learn You A Erlang. For a more language-agnostic (theory based view) you could start with Lambda Calculus.

share|improve this answer
    
Recommending lambda calculus here is like recommending electrical engineering in order to learn programming in general. –  delnan Mar 8 '11 at 16:20
1  
@delnan, functional programmin is lambda calculus. You can't learn one without another. –  SK-logic Mar 8 '11 at 16:29
    
@SK-Logic: Programming (idiomatically) in any real-world functional language and solving problems has little to do with learning the math/theory behind the concepts you're using there. In fact, if you understood the former the latter seems like both more theoretical and less powerful - there's a lot more about FP than defining an applying (recursive) functions. Even super-simple lisps are built on more things (you have lists, numbers, strings, booleans and possibly more types, you have macros, etc.). –  delnan Mar 8 '11 at 16:32
    
@delnan, OP is asking about a paradigm. It is not easy to comprehend a paradigm without a theory. Practical examples in any particular language won't help. –  SK-logic Mar 8 '11 at 16:36
    
@SK-Logic: Burying OP in a super-simple, theoretical/formal system that happens to include some of the core concepts on FP won't help. What's better to make a programmer embrace e.g. recursion, math oder practical examples? Yes, no language represents the whole paradigm. But it can be used for examples of large parts of the paradigm (more than lambda calculus even touches - there are lists in basically every FP language!). –  delnan Mar 8 '11 at 16:41

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