views:

409

answers:

7

With all the hype around functional programming, which are the best resources to getting started in functional programming [for a C# programmer]? I am not looking for C# 3.0 language improvements.

A: 

I learned functional programming in college, using language Haskell.

In its homepage you most likely find what you need to get started :)

BTW, it takes a lot of practice to see the solution; algorithms, as such, are not what everybody's used to code in Object-Oriented, logic or procedural languages.

Seb
+10  A: 

I think for a C# developer with .NET background, the best way to enter functional programming is to learn F#.

Mehrdad Afshari
Finally i have got enough motivations to try F# instead of Haskell. Thanks
suhair
+2  A: 

Spend some time looking at Lisp or Scheme as they're the mother and father of functional programming. PLT Scheme is a great environment to play with Scheme. Get yourself a copy of The Little Schemer as it's a good introduction to Scheme and will help you get up to speed fairly quickly.

Once you've got your head around functional try doing some of the Project Euler problems in a functional way.

Sean
+3  A: 

Pick a functional language. Python has many functional features. Haskell is purely functional.

Go to Project Euler.

Solve some problems.

If you look at the Project Euler stats, Python and Haskell are very highly ranked.


Edit

Functional Programming in Python:

S.Lott
+1 despite the Python plug (is it so NOT functional :))
OJ
@OJ: Added references from folks who seem to think Python does supports functional programming.
S.Lott
A: 

I agree with Mehrdad Afshari. If you are familiar with C# start functional programming with F#. The syntax is similar to lambda expressions in C#.

Alexander
+11  A: 

Shameless plug: I'm the co-author (well, glorified editor really :) of Real World Functional Programming. It's squarely aimed at people such as yourself. It teaches the principles of functional programming, mostly via F#, and also shows how you can apply the same principles in many cases in C#.

It assumes you know C# already, but introduces F# from scratch. It gives you enough knowledge of F# to get you started so you can experiment, but the aim is to teach a functional way of thinking rather than going into every nook and cranny of F# as a language. (In other words, if you want to start using F# as a production language, I'd get another book as well.)

It's not out yet, but you can get early access via the MEAP programme. Several chapters are available already, with more coming soon.

Jon Skeet
Any suggestions for other resources until the dead wood version of that book releases?
suhair
If you're keen on dead wood rather than ebook, there are two Apress F# books: Foundations of F# (Robert Pickering) and Expert F# (Don Symes)
Jon Skeet
I'm just reading through the free section of this from the Manning site - very interesting stuff and it's well written.One small thing: Page 16 has "The code first creates a temporary list to store all died characters. " - could do with an edit Jon!
Steve Claridge
@Steve: The online stuff is before I started working on it :) Downvoters/offensive voters: care to give reasons? It's not like I'm plugging the book in an unrelated question, and at least I was honest about it...
Jon Skeet
It seems spammy to get rep for offering a product of your own, regardless of whether or not you provided a disclaimer. Thats why I marked you down, just like I have done to others (Thomas Hansen). No personal beef or insult intended here, just the way I see it.
StingyJack
@StingyJack: I didn't get any rep for the answer anyway as I'd already hit the limit for the day. (i.e. for this question with a net 3 upvotes, my rep difference is -4.) But surely the key test is: is this a useful answer to the questioner? If it is, does it matter whether it's also self-promotion?
Jon Skeet
I completely agree that promoting your own blog/book/site/whatever when it's unrelated to the question should be downvoted, btw - because it means it's not a helpful answer. It's when it *is* a helpful answer (which I think this is) that it seems odd to downvote it.
Jon Skeet
Since you have been so kind as to reiterate the rules for me, I have removed the down vote. After having legitimately helpful and pertinent responses of my own get dv (for whatever reason), I get stuck in the mode of good/bad evaluation of responses, not whether they are helpful or unhelpful.
StingyJack
+2  A: 

The free online version of Real World Haskell is a good, cheap way to get started.

Once you've done a few chapters, you'll be in a position to decide whether FP is for you, and whether you want to continue with Haskell or move on to some other language. You may even go on to buy the dead tree version (as I did).

The paradigms you learn from this book, especially the opening chapters, apply equally well to other functional languages. (I like to think my Javascript and Groovy benefited from my studying Haskell).

slim