3 ms·
You're getting mixed up with what a technical form of functional programming is (which can be summarized with "nothing changes", which is more inline with your
by Jach 15y ago
You're getting mixed up with what a technical form of functional programming is (which can be summarized with "nothing changes", which is more inline with your "pure" quantifier; try this: http://academicearth.org/courses/the-structure-and-interpretation-of-computer-programs http://academicearth.org/courses/the-structure-and-interpret... ), and with features of what members of the Functional Family tend to have.
If you ignore closures, C has "inline [anonymous functions]" as well as "first class functions" in the form of function-pointers. The fact that the syntax is less than pleasant doesn't mean you can't do those things in it. C is also Object-Oriented-Capable, just like C++. Ignoring the C debates, you can even go up to ActionScript/Javascript which have those features you described, yet I wouldn't call them functional programming languages even if you can write functional code in them. They don't embody the ideal of "nothing changes" that, as you say, is more "purely functional". What member of the Functional Programming Language family loves the idea of side-effects? They all support it begrudgingly of course.
- chc 15y agoI don't see how function pointers allow inline or anonymous functions. They point to already-defined functions, which can't be defined inline or anonymously.
- Jach 15y agoGuess you missed this: http://news.ycombinator.com/item?id=2718252 http://news.ycombinator.com/item?id=2718252
- chc 15y agoThat's not really C, nor is it a property of function pointers in that example — it's a nonstandard GCC feature that happens to be returning a function pointer in that particular instance. If you know of a way to do it without requiring a non-C feature like expression blocks, I'm all ears.