Ask HN: Resources to Learn Functional Programming? - p33p
======
brudgers
_How to Design Programs_ for a longer, beginner oriented text. The Racket
tutorials for a shorter and multi-level introduction. Several Edx programming
courses from University of British Columbia use Racket and are built around
the _HtDP_ methodology. The Racket ecosystem, like any engineering artifact
makes tradeoffs. In the case of Racket, some of the tradeoffs are driven by a
goal of _teaching_ functional programming in addition to
allowing/encouraging/requiring functional programming.

Circling back to _HtDP_ , though organized as an introductory text, a more
experienced programmer might benefit from working through it as a way of
developing a discipline for functional programming. That is, when _HtDP_ is
the only exposure to programming a beginner has, programming == functional
programming. On the other hand, an experienced programmer has programming
habits which must be set aside when learning functional programming and that
may be a harder task.

~~~
DavidGabriel
HtDP vs SICP who will winner in your opinion ?

~~~
brudgers
The person who reads both. My recent comments that came out overly harsh in
terms of the initial criticism of _HtDP_ 's aesthetics,
[https://news.ycombinator.com/item?id=16563160](https://news.ycombinator.com/item?id=16563160)

------
mercer
Considering both the language and the ecosystem/community, I'd recommend
Elixir.

Both the language and the community bear resemble my experience with Ruby.
Like Ruby, the language is relatively beginner-friendly, and the community is
very welcoming and helpful.

The language is probably my favorite so far. For me it hits the pragmatic
sweet spot between enforcing functional programming without being needlessly
strict/pedantic about it, or overwhelming me with FP concepts. That can be
considered a downside too, of course, but in my case it really helped me ease
into functional programming in a way that other languages did not (Haskell was
a bit too much, and Clojure felt too alien, for example).

The friendly community matters a lot when you're in the 'stupid questions'
phase. More than once my undoubtedly very silly questions were answered
promptly, often even by the creator of the language. My experience with quite
a few other 'functional' communities is that there's an unfortunate tendency
toward condescension, or a kind of academic elitism that made me avoid asking
what I thought might be stupid questions.

Furthermore, people actively try to teach functional principles, and in
particular the Phoenix web framework is great even just to see how things are
done (I often add it to my projects just for reference). Dave Thomas, who is
an excellent and prolific teacher/language enthusiast, has more than once
expressed his affection for Elixir as a language to teach functional
programming.

Another advantage is tooling. One of the explicit goals set by the creator
(Jose Valim) was to make the language 'friendly'. So very often error messages
give hints on how to do things instead, and there's an automatic formatter
that 'fixes' stuff for you (proper indentation, idiomatic code style, etc.).
The documentation for the language, packages and functions are probably my
favorite ever, and it comes with other goodies like a testing framework,
interactive code shell (REPL), a really nice package manager and probably some
other stuff I forgot.

And finally, even though it's by no means a very popular language (yet), it's
well on its way to being a 'mainstream' functional language, and it's
something you can actually _use_ for a lot of stuff (backend development,
scripting, or to start a telephony company ;).

Btw, if anyone else is already playing around with Elixir, I can highly
recommend searching for Dave Thomas' articles and videos. They're an excellent
way to learn FP as well 'why' FP is interesting/important/worthwhile.

------
fsloth
'F# for scientists' by Jon Harrop is excellen. It's a bit pricey, but provided
tremendous value on the how and why of functional paradigms within the scope
of practical, brief programs.

'Expert F#' by Don Syme et all is a fantastic reference.

Real World Functional programming by Tomas Petricek is very good as well.

'Programming language concepts' by Peter Sestoft is fantastic as well, as
programming languages are perhaps the most obvious domain where functional
approach shine, and the concepts are needed everywhere even though one was not
implementing an interpreter.

~~~
auxym
I was about to post pretty much this list, perhaps also with Scott Wlaschin's
stuff. His blog F# For Fun and Profit:

[https://fsharpforfunandprofit.com/](https://fsharpforfunandprofit.com/)

And his talk on functional "design patterns":

[https://vimeo.com/113588389](https://vimeo.com/113588389)

------
elorm
I’m assuming you already have experience with one imperative language.

Graham Hutton’s programming in Haskell is a really great book and will get you
up and moving in no time.

If you’re new to programming, id suggest Haskell Programming from first
principles by Chris Allen And Julie Moronuki. It’s a very large book(1000+
Pages) but teaches you functional programming concepts from scratch in Haskell
without assuming any previous exposure to the language

------
johnsonjo
Here’s some I’ve used. Mostly just beginner stuff though.

Professor Frisby’s mostly Adequate Guide to Functional Programming by Brian
Lunsdorf is great[1]. A pretty solid book meant for beginners that introduces
functional programming in a simple manner without over burdening you with all
the math. It uses JavaScript, and helps you create a lot of the functional
programming patterns yourself.

Learn You a Haskell For Great Good [2]. This book is pretty light hearted and
an entertaining read. It’s for beginners. I’ve heard a good follow up to this
one is Real World Haskell, but I’ve also heard the code for it is outdated,
but I’m not certain whether it is (I’ve never read it.)

There is a course on egghead.io that is free by Brian Lonsdorf the author of
the Mostly Adequate guide [3]. I hesitate recommending this one as it’s got a
pretty different approach and uses stop motion that can take some getting used
to and the voices can be somewhat annoying, but overall great content wise and
covers many of the things in the Mostly Adequate guide. He also does a course
on Frontend Masters which is just him giving a workshop in person so no stop
motion or weird voices.

Lastly I haven’t actually read this one even though I believe I purchased it
when I first saw it announced by the author and it is, Functional Light
JavaScript by Kyle Simpson [4]. Great author that always takes a r ally great
approach to explaining things he wrote the You Don’t Know JS series that he
released through O’Reilly and also put up on github. Kyle Simpson also has a
course on Frontend Masters modeled after his book Functional Light JavaScript.

[1]: [https://github.com/MostlyAdequate/mostly-adequate-
guide/blob...](https://github.com/MostlyAdequate/mostly-adequate-
guide/blob/master/README.md)

[2]: [http://www.learnyouahaskell.com](http://www.learnyouahaskell.com)

[3]: [https://egghead.io/courses/professor-frisby-introduces-
compo...](https://egghead.io/courses/professor-frisby-introduces-composable-
functional-javascript)

[4]: [https://leanpub.com/fljs](https://leanpub.com/fljs)

~~~
jwdunne
I've been reading the Mostly Adequate guide. It's helped me. The explanations
for functors and what not really helped things click after going through other
articles.

------
davidgl
Brilliant introduction to static FP, uses F# but applicable to Elm, Occaml,
Purescript, Haskell, etc.

[https://fsharpforfunandprofit.com/](https://fsharpforfunandprofit.com/)

------
sizeofchar
Resources that truly taught me functional programming were Erik Meijer’s
course on edX and it’s companion book, Programming in Haskell by Graham
Hutton, and then Learn you a Haskell web book.

------
i_feel_great
Assuming you are starting from scratch - start with the Lua programming
language. It is very easy. Practise writing everything as a function, practise
composing everything from standalone, unit functions, practise writing
recursive functions that use proper tail calls, practise writing co-routines.
From there is will be a lot easier to pick up languages like OCaml, F# and
Erlang - it will all be syntax, libraries and type systems.

------
otikik
I've recently used Lambdacast - [http://lambdacast.com](http://lambdacast.com)
and I recommend it.

It's a podcast which focuses on teaching FP "to the working programmer". One
of the authors was a novice when the podcast started, and he asks questions
"keeping the discussion grounded" (most of the time). It's not centered on one
particular language or framework. I've been listening to them while doing
menial tasks like cleaning up my kitchen and I can understand some concepts
now that I could not before.

------
znt
You can just visit [http://www.4clojure.com/](http://www.4clojure.com/) and
start practising Clojure. No need to install anything.

------
PaulStatezny
This isn’t the type of answer you were asking for, but...

Apprenticeship is invaluable. If you can, find an adept functional programmer
to learn from.

I was fortunate enough to get a job at a place using Elm and Elixir, and I had
the opportunity to learn from another developer with a lot of passion for FP.
It was incredibly helpful for learning.

Good luck! FP is a great tool for your tool belt and teaches a lot about good
code design.

------
icc97
I found the funfunfunction videos on functional programming [0] very useful

[0]:
[https://m.youtube.com/playlist?list=PL0zVEGEvSaeEd9hlmCXrk5y...](https://m.youtube.com/playlist?list=PL0zVEGEvSaeEd9hlmCXrk5yUyqUag-n84)

------
lambda00000010
"learn you a haskell for great good" is a good light introduction to haskell
and functional programming

------
jiyinyiyong
Learn Haskell and use Clojure/Elixir/Scala/ReasonML/Elm...

