r/functionalprogramming • u/Neither-Acadia2395 • Nov 05 '23
Question Why is functional programming so hard
Throughout my entire degree till now, I’ve been taking OOP. Now I am in a FP course and I am struggling a lot. I understand it’s almost a total different thing. But I just failed a midterm in FP in Ocaml. I swear I could’ve solved the questions with my eyes closed in OOP. What am I doing wrong, why can’t I get a grasp of it. Any tips on how I should approach studying this.
78
Upvotes
View all comments
Show parent comment
2
u/[deleted] Nov 06 '23
Arguably Python does have lexical scoping, it just also has late-binding of non-local names. You can definitely use Python in a very FP manner, and in a lot of ways very successfully and with a big improvement in code quality.
Sadly what you cannot do is forget about gotchas like late binding on lambdas and nested named functions. Non-local names are a pain point, but they’re not a complete bar to grokking (and using) FP concepts.