r/functionalprogramming • • 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

87 comments sorted by

View all comments

Show parent comment

1

u/keszegrobert Jan 31 '24

I dont think so. I have experienced Basic from the eighties, pascal from the nineties, then Delphi, C++ with visual studio, and switching to FP was the hardest for me.

3

u/teach_cs Jan 31 '24

But those are all variants of the same underlying paradigm, which is imperative programming. I know we call OOP and various other things paradigms, but every OOP language is a multi-paradigm language, and they are basically all imperative.

I suspect that the real paradigm switch that gets people so confused is the switch to declarative programming. In every other language you mention, you tell the computer what to do, whereas in declarative languages, you tell the computer what to compute - it's a wild difference.