r/functionalprogramming • • Oct 16 '18

Question Path to learn functional programming

Background - After my internship, my supervisor told me that I needed to work on my program design and learning functional programming would be a step in the proper direction as it would force me to think in a particular way.

Steps taken - He suggested learning scala, but since it is not strictly functional I was not really "forced" to program in a functional style.

Programming Language Experience - Java, Python, Scala

Most functional programming language tutorials/books out there focus on the language and not "functional programming" (The language is always the easy part - It does not take that much time to pick it up).

I would love any suggestions on how to go about learning functional programming. Thanks.

36 Upvotes

24 comments sorted by

View all comments

5

u/nasoloaina Jan 17 '19 edited Jan 17 '19

I think "Functional programming in Scala" by Paul Chiusano and Runar Bjarnason is really good in teaching FP concepts. Scala is used as a mean here but the concepts of FP and their use can be applied and translated to other languages as well. You should give it a shot.

Another book that's worth mentioning is "The Joy of Clojure" though it's more tied to FP and programming the "Clojure way". It's definitely not a beginner book since you have to have a prior experience with Clojure to fully get a grasp of the concepts. What I'd suggest if you're interested in reading that book is to get a general purpose Clojure book first, practice a little bit then read it after you've got the fundamentals of the language.

In terms of language, I'd rather go with Scala first or any language whose syntax is more familiar to you (algol family language). The reason is that if you try to learn syntax and more abstract (foreign) concepts at the same time (like Lisps), the cognitive load can make you can feel discouraged in the end and you would give up. So begin with something you're familiar with first, but as soon as you want/need more do not hesitate to go further and explore other things. And by further, I am talking about Lisps for example (talking about Clojure earlier )...it can rewire your brain in very strange ways... but for the good hopefully.

To sum it up :

  • learn the FP concepts

  • apply the concepts with a language you're familiar with

  • review the concepts (you need this feedback : the aha!! moment should happen here )

  • apply the concepts to other languages as well : it seems that variation in learning helps a lot because it somehow trains your brain to "translate" and "transfer" knowledge based on contexts... which is the goal anyway 😊

  • remember, learning takes time...have patience

Good luck and more importantly have fun ^