4 ms·
Ask HN: The best plan to learn the functional programming paradigm
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.
I need help in preparing a plan which is something like below.
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.
- umeshkacha 15y agoStart learning Scala. Its JVM language you will have Java feeling as you can use Java libraries in Scala. Its very good FP language to learn. Its next Java I believe.
- thaumaturgy 15y agoIf 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 15y agoI love both Closures as well ans Anonymous functions.
- wagemanh4x 15y agoIf 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
- jamesbritt 15y agoYou 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 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://learnyouahaskell.com/chapters http://book.realworldhaskell.org/read/ http://book.realworldhaskell.org/read/
- digamber_kamat 15y agoThanks this is exactly the kind of advice I was looking for.
- tjr 15y agoWhich 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.