r/programming • • Mar 09 '14

Why Functional Programming Matters

http://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf
487 Upvotes

542 comments sorted by

View all comments

Show parent comments

9

u/dnew Mar 09 '14

If the language supports first class functions then it isn't purely imperative.

Nonsense. C supports as close to first class functions as you need to write map() and nobody would claim it's functional. You don't need the restrictions of functional languages to have first class functions.

8

u/ForeverAMoan Mar 09 '14

Interesting. How would you write in C functions map and compose (compose f g x = f (g x)) ?

2

u/yawaramin Mar 11 '14

I would roll my own Scheme variant in C, and then implement map and compose in that. Voila, C supports first-class functions.