Hacker News new | ask | show | jobs
by SubMachineGhost 2851 days ago
> Because it's hard and non-obvious.

I would argue that for someone who never programmed functional programming will be much easier to learn.

Your statement is only correct for people who programmed for years in an imperative style and then tried to pick up FP, because at this point you have a lot of unlearning to do, and a lot of your know how becomes absolute, don't use variables, don't use loops, push your side effects out... and after all this unlearning you'll have to learn new concepts and abstractions like Monads and Applicative...

1 comments

Do you think monads, functors, recursion, and immutability (just to take a few staples of functional programming) are easier for a beginner to wrap their head around than loops, re-using variables, etc?

I would be surprised if, using a sample group of say 100 beginner programmers, the majority found Haskell easier to learn and write beginner stuff in than JavaScript, python, or insert-primarily-imperative-language-here.

Most of these are advanced topics though. You don't teach a beginner about OOP design patterns from the get go either.

If you start with defining functions, calling them, composing them, and using map/filter/reduce and all the stream like operations filter, remove, select, merge, substract, etc. I think it might be just as simple.

Haskell is a bad choice though, because it also forces you to learn about advanced type theory.

The truth is, I do believe there is a gap in that there's no FP language that doesn't also introduce another complex paradigm. MLs introduce advanced type theory. Lisps introduce advance meta-programming and homoiconicity.

If you take Python, and teach it using only its FP constructs, I think that is probably simpler to learn to a beginner.