r/functionalprogramming • u/xrabbit • Aug 03 '23
Question What is a good point to start learning FP ?
And what language do you suggest to start writing some simple FP code?
I just want to grasp basic FP concepts and be able to read spherical FP code in vacuum
What do you think about Scheme? Haskell?
I don't plan to become a professional FP programmer (at least for now), just want to get a basic understanding how FP works and because of that I don't want to learn a language with a complex syntax just for that
I want to distribute my learning time some things like:
[20% syntax learning | 80% coding ]
PS: thanks everyone for their responses! You helped me a lot to understand what I really need and share useful resources to learn
So, my plan:
- Scheme (Concrete Abstractions book - seems like super easy introduction into FP, and I have scheme REPL on the phone)
- Haskellish Concepts book - has epub, convenient to read on the go and all required FP concepts
- Clojure (since I already know Java well enough, Clojure for brave and true book)
•
u/kinow mod Aug 03 '23
u/xrabbit, you may find useful to look at previous threads on this subreddit about getting started with functional programming. They are collected in our Wiki:
https://old.reddit.com/r/functionalprogramming/wiki/getting-started
13
u/[deleted] Aug 03 '23
While you can do FP in most modern multi paradigm language I would give you the tip to choose a language that "forces" you to do FP. Clojure and Haskell are two that come to my mind. The reasoning behind that is that you have to learn how to manage state and side effects in a different way than in OOP or procedural programming. If the language makes immutability the default it is less likely you will start to write code like you are used to.
I personally would recommend clojure. It's easy to set up and because it is a Lisp there is not much syntax to learn.
10
u/[deleted] Aug 03 '23
https://haskell.mooc.fi/
6
u/brunogadaleta Aug 03 '23
JS Ramda, Purescript, clojure.
Be sure to have a look at this : https://youtu.be/vK1DazRK_a0
6
u/KyleG Aug 04 '23
There's no point because FP is point-free. :P
5
u/dr_bbr Aug 03 '23
F# has pretty syntax.
5
u/yawaramin Aug 03 '23
https://cs3110.github.io/textbook/cover.html
It has a bit of a preamble to explain its conceptual approach, but then starts teaching the actual language (OCaml) in fairly short order.
4
u/Hk-Neowizard Aug 03 '23
I don't know Haskell, but it's probably the most popular among the FP community.
Personally I love Ocaml/F# for its type system and quality-of-life features (i.e. auto currying and pattern matching). Wrote my thesis in Ocaml, and it was great.
Scheme is a rather dead language, but a good gateway drug for something like Clojure. It's VERY easy to learn but the syntax is extremely foreign for most programmers.
I used Scheme and Ocaml for a course I taught for several years. Scheme is much easier to get into, but it's limited. You said you're not going planning to become a professional, so it's probably a good fit.
4
u/SnooCompliments7527 Aug 07 '23
I would just recommend trying Elixir in there somewhere.
It's an interesting take on the FP paradigm. No type system but immutable data structures. And, a lot of recursion.
3
u/SteeleDynamics Aug 04 '23
SML and Scheme
3
u/UnusualSeaOtter Aug 04 '23
Depends on where you’re coming from.
If you’re already familiar with web development Elixir has approachable syntax and (along with Phoenix) will get you into building usable projects pretty quickly. It doesn’t have static types so you won’t get the full FP experience but you will learn how to organize code without objects.
I’ve also been really enjoying Elm for similar reasons. It’s got much more Haskell-like syntax, and will let you build fancy frontend applications quickly.
3
u/nmarshall23 Aug 04 '23
Learn Haskell by solving https://projecteuler.net math problems.
This lets you stay focused on learning how to solve problems in a pure FP way.
3
u/pthierry Aug 04 '23
I would start with Elm. It's very easy to start playing with and to get a working , interactive UI, if you already know web development, it's pretty intuitive, and as with Haskell and Purescript, the language enforces purity, which prevents you from going around the constraints of FP.
If you like Elm and want to go deeper into what FP can offer, then I'd recommend you start playing with Haskell.
2
u/dobkeratops Aug 22 '23
personally i'd go for one with eager eval .. easier to make it useful. use that as a gateway drug, rather than diving straight into the pure-FP,lazy-eval of haskell
2
u/[deleted] Aug 03 '23
[removed] — view removed comment