Re:Hey, C Is a Functional Language Too
by ginko on Friday November 02, 2012 @07:06AM
(#4732051)
Yes, but you can't combine function pointers to create and return new functions.
[ Parent
| on HN ]
Sure you can - just not anonymously. Kind of like how you can have "higher order functions" and "closures" in Java with anonymous classes - roughly equivalent, but awkward and not quite what the language was designed for. C is probably better in this regard than Java, but the lack of managed memory is a major drawback.
Re:Hey, C Is a Functional Language Too
by JoeAltmaier on Friday November 02, 2012 @10:31AM
(#4732739)
Right. SO you can program 'functionally' in those languages, but they are not 'functional programming languages' because they don't support it natively.
"just not anonymously"
Just not depending on anything in the environment either except globals, which is a huge limitation. So writing a function inc by = \x -> x + by becomes unnecessarily difficult for example.
Re:Hey, C Is a Functional Language Too
by aaronblohowiak on Friday November 02, 2012 @03:41PM
(#4734386)
then you just have a void* / fn ptr couple that you pass around..