Ask HN: Best way to start with functional programming?
Any ideas on the best way to get started with functional programming?
I’m thinking of Clojure/ClojureScript+React, Haskell, Scala, or Elixir. Especially in the context of web or mobile.
The FP I’ve done so far is however much FP you can do with JavaScript/Python (currying, higher order functions, map/filter/reduce, underscore), and about a third of SICP (Scheme).
(
13 comments
| 26 points
| on HN
)
http://learnyouahaskell.com/chapters
If you go down this route: Once you start getting to chapters that don't have direct analogues in other languages, such as Functors, Applicative Functors, Monads, etc, slow down. A lot. I tried numerous times to just push through in the hopes that it would all come together, and I ended up giving up because I just dug myself further into a pit of nonunderstanding and frustration.
Give yourself time to let the strange concepts sink in. Use them several times until you truly understand them. Then move on.
Scala is a great choice for people familiar to Java, and don't wan to give up all the JVM knowledge they've gained over the years.
I personally prefer Clojure/Clojurescript and the direction that the community is heading.
I took a coursera course[1] on programming languages a while back that did an introduction to ML, Racket, and Ruby. It was great to through similar problems in three very different languages. It gives you the basic information you need to weigh the costs and benefits of using a particular language in a particular context.
[1] https://class.coursera.org/proglang-2012-001/wiki/syllabus
I'm a total noob with this stuff but I've been really happy with Clojure (and more recently ClojureScript/Om) :)
[0] http://www.amazon.co.uk/Little-Schemer-Daniel-P-Friedman/dp/...
It also has an irc channel that is fairly active (#haskell-beginners).
But, if you are like me, you need to understand the motivations and intensions behind things before you can really feel that you have reached understanding. You know, the big picture type stuff.
So, in my opinion, to fully understand functional programming, you need to think about what it tries to do/solve. To get here I would recommend thinking about insanely complex systems and how you would build a flexible and efficient one. To start you may think about all the objects you would need to account for, which, eventually, causes insanity. Its not the objects in the system that causes the complexity, it's their interactions. So, you may start thinking about handling all of the interactions, which is where, I believe, the solution (really method is the better word) lies.
I believe then, that the key to understanding functional programming is to understand what its related concepts are able to solve. Thinking about how to make sense of and control this shitstorm of complexity will, hopefully, shed light on why the hell something called an "applicative functor" or, <insert other crazy/weird term> even exists.
I know, I know, I am being too general... the stuff comes from category theory though, so, uh, hard not to be... but seriously, if this is at all helpful and not totally incorrect, I'd be happy to expand in more detail
if, on the other hand, it is not helpful... forget it totally, learn a language, and hopefully the concepts follow else if, I am totally incorrect... why and where did it all go so wrong? else, nop
https://www.coursera.org/course/progfun
The course was very challenging and I learned a lot in a very short period of time. Highly recommend it.
https://github.com/paf31/purescript-book/blob/master/chapter...
Regarding Haskell, I didn't love Learn You a Haskell, but did like Learn Haskell Fast and Hard.
Just pick a project and a most aproppriate lenguage and roll with it. You probably can guess, what language would suit your needs best, and if you haven't made up your mind about that, I (or other HN user) will probably suggest good fit for your project of choice :)
https://github.com/bitemyapp/learnhaskell