

Ask HN: The best plan to learn the functional programming paradigm - digamber_kamat

I have enough experience in programming in JAVA,PHP and JavaScript. I am curious to learn functional programming paradigm. I dont think my knowledge of FP is going to have any impact on my career in near future. I want to learn it only for the knowledge sake and who knows it might help me do my existing stuff in a better way.<p>I need help in preparing a plan which is something like below.<p>1. Which should be my first FP language ? 
2. Should I start learning the languages directly or gather some mathematical background from any other source ? 
3. Which should be the first book/videos I should go through ?
4. Can anyone suggest me a sample project that might help me build and apply all the concepts? When I was learning JAVA we had built a pet store and when I learned PHP I had built a social networking app.
======
jamesbritt
You first concern will be to define just what makes for a functional
programming language. Is having first-class functions enough? What about
referential transparency or immutable state? Does it have to adhere to the
Lambda Calculus?

You might get some ideas here:
<http://en.wikipedia.org/wiki/Functional_programming>

However, "What's FP?" is ripe for flame wars so you may do better to ask abut
languages that offer specific characteristics rather than whether or not
people call it a functional programming language.

That said, I'd suggest Haskell. I mean, what the hell, might as well go
hardcore. Start with Learn You a Haskell For Great Good, and/or Real World
Haskell.

Both available free online, both available as for-purchase books, both well
worth the money.

<http://learnyouahaskell.com/chapters>

<http://book.realworldhaskell.org/read/>

~~~
digamber_kamat
Thanks this is exactly the kind of advice I was looking for.

------
thaumaturgy
If you're familiar with JavaScript, then some of its advanced features can
"ease" you into functional programming:

1\. Closures. Closures are handy for lots of things, but a lot of people
(myself included) have said that they had difficulty understanding them at
first. I don't know what your knowledge level is so I won't presume that you
need a tutorial, but if you do, a lot of people here should be able to help.

2\. Anonymous functions. You can create functions on-the-fly, you don't have
to name them, then store them in a variable and call the variable.

I don't really "know" any functional programming languages, but these things
are apparently common concepts in that arena, and playing around with them in
a language that you're familiar with might make it easier for you.

I'd be willing to go into more detail if you'd like, or provide examples. I
have tens of thousands of lines of JavaScript, and a lot of it takes advantage
of JS' functional programming stuff.

~~~
digamber_kamat
I love both Closures as well ans Anonymous functions.

------
tjr
Which language to learn is a matter of taste. I personally think Scheme would
be a good choice.

Learning the mathematical background first might be a good idea if you're a
mathematician. Otherwise, getting at least some practical exposure in a
language may cause the math to make more sense to you, should you decide to
study it later.

For Scheme, some good books include: _The Little Schemer_ and _Structure and
Interpretation of Computer Programs_.

A good sample project might be to build some sort of language intepreter. For
Scheme-based ideas, take a look at the book _Essentials of Programming
Languages_. One of the early projects in that book is to build an arithmetic
expression evaluator; by that point, you should be well on your way to
thinking functionally.

------
wagemanh4x
If you have already learned two languages by building things and it is a model
that has worked for you then use the same model. When it stops working improve
the model or throw it out and work on a different learning method.

I learned Lisp by building.

I recommend you build and fail and build more. You will learn a lot that way.

edit: grammar fail

