TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Best way to start with functional programming?

26 pointsby brianchualmost 11 years ago
Any ideas on the best way to get started with functional programming?<p>I’m thinking of Clojure&#x2F;ClojureScript+React, Haskell, Scala, or Elixir. Especially in the context of web or mobile.<p>The FP I’ve done so far is however much FP you can do with JavaScript&#x2F;Python (currying, higher order functions, map&#x2F;filter&#x2F;reduce, underscore), and about a third of SICP (Scheme).

13 comments

gamegoblinalmost 11 years ago
Most Haskellers will point you at <i>Learn You A Haskell For Great Good</i>.<p><a href="http://learnyouahaskell.com/chapters" rel="nofollow">http:&#x2F;&#x2F;learnyouahaskell.com&#x2F;chapters</a><p>If you go down this route: Once you start getting to chapters that don&#x27;t have direct analogues in other languages, such as Functors, Applicative Functors, Monads, etc, <i>slow down</i>. 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.<p>Give yourself time to let the strange concepts sink in. Use them several times until you truly understand them. Then move on.
chrismccordalmost 11 years ago
FP is going to feel like programming 101 at first before you get over that initial hump. That&#x27;s the way it went for me at least. The trick is seeing it through and making it past that first frustration phase. Once it clicks, it will change the way you think about programming. I&#x27;d say pick up the defacto book in one of the langs you listed and get started! I went with Elixir, and I&#x27;m hooked. Dave Thomas&#x27; <i>Programming Elixir</i> is an excellent place to begin.
narwallyalmost 11 years ago
I think it all depends on what you&#x27;re background is in. If you want to be able to work on the JVM, then Clojure an Scala are going to be your obvious betts. If you&#x27;re coming from a dynamic language (python&#x2F;ruby&#x2F;javascript) then it may be easier to take on a lisp(or other dynamic-functional language) as your fist FP language.<p>Scala is a great choice for people familiar to Java, and don&#x27;t wan to give up all the JVM knowledge they&#x27;ve gained over the years.<p>I personally prefer Clojure&#x2F;Clojurescript and the direction that the community is heading.<p>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.<p>[1] <a href="https://class.coursera.org/proglang-2012-001/wiki/syllabus" rel="nofollow">https:&#x2F;&#x2F;class.coursera.org&#x2F;proglang-2012-001&#x2F;wiki&#x2F;syllabus</a>
jongoldalmost 11 years ago
I really liked The Little Schemer[0]. The language&#x2F;syntax is a little different to Clojure but it&#x27;s broadly transferable; really helped me think functionally.<p>I&#x27;m a total noob with this stuff but I&#x27;ve been really happy with Clojure (and more recently ClojureScript&#x2F;Om) :)<p>[0] <a href="http://www.amazon.co.uk/Little-Schemer-Daniel-P-Friedman/dp/0262560992" rel="nofollow">http:&#x2F;&#x2F;www.amazon.co.uk&#x2F;Little-Schemer-Daniel-P-Friedman&#x2F;dp&#x2F;...</a>
biscarchalmost 11 years ago
IMO Haskell is your best option if you want to learn functional programming (being a purely functional language) and this is the best guide to learning Haskell I&#x27;ve come across: <a href="https://github.com/bitemyapp/learnhaskell" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bitemyapp&#x2F;learnhaskell</a><p>It also has an irc channel that is fairly active (#haskell-beginners).
philreaalmost 11 years ago
First I&#x27;ll second the other comments mentioning &quot;learn you a haskell&quot;. I dont know haskell in the way an expert does, nor do I have very much exp writing it but, I can and enjoy when I do. &quot;learn you a haskell&quot; does a great job at speaking in clear english and is, honestly, an enjoyable book that is pretty fun to read.<p>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.<p>So, in my opinion, to fully understand functional programming, you need to think about what it tries to do&#x2F;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&#x27;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.<p>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 &quot;applicative functor&quot; or, &lt;insert other crazy&#x2F;weird term&gt; even exists.<p>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&#x27;d be happy to expand in more detail<p>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
xiaomaalmost 11 years ago
I found Martin Odersky&#x27;s Scala course on Coursera to be a great intro, and my background at that time was similar to yours. Scala itself isn&#x27;t that great for learning FP since it&#x27;s entirely possible to write in a Java-like style. However the Coursera class uses a functional style and the autograder ensures you do too.
schmidtcalmost 11 years ago
I found the Functional Programming Principles in Scala course on Coursera to be incredibly helpful<p><a href="https://www.coursera.org/course/progfun" rel="nofollow">https:&#x2F;&#x2F;www.coursera.org&#x2F;course&#x2F;progfun</a><p>The course was very challenging and I learned a lot in a very short period of time. Highly recommend it.
codygmanalmost 11 years ago
Also checkout the purescript book being created:<p><a href="https://github.com/paf31/purescript-book/blob/master/chapters/1%20-%20Introduction.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;paf31&#x2F;purescript-book&#x2F;blob&#x2F;master&#x2F;chapter...</a>
hyperpapealmost 11 years ago
Learning a more functional language is a good idea, but you can also do more within JavaScript itself. Well after I&#x27;d been using higher order functions and Underscore, I found Michael Fogus&#x27;s Functional JavaScript to be quite good. There is also JavaScript Allongé by Reginald Braithwaite, which I want to read soon. For libraries, there&#x27;s Lemonad, Bilby and Fantasy Land, all of which push the boundaries of functional programming past what you get from Underscore.<p>Regarding Haskell, I didn&#x27;t love Learn You a Haskell, but did like Learn Haskell Fast and Hard.
a-salehalmost 11 years ago
To be honest, best way so start FP, is to have project where you are forced to do FP :) In my case it has been a quite an awesome small selenium test-framework written in clojure I needed to use, while working for RedHat :)<p>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&#x27;t made up your mind about that, I (or other HN user) will probably suggest good fit for your project of choice :)
garrettdreyfusalmost 11 years ago
I started Clojure this week. It&#x27;s really fun and it&#x27;s syntax doesn&#x27;t boggle my brain as much as Haskell&#x27;s.
codygmanalmost 11 years ago
If you want an introduction to functional programming, why not go all the way with a pure functional language such as Haskell:<p><a href="https://github.com/bitemyapp/learnhaskell" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bitemyapp&#x2F;learnhaskell</a>