On Sat, 22 Dec 2007 16:25:26 +0200, Miguel Mitrofanov
<[EMAIL PROTECTED]> wrote:
That's not C.
That's the C preprocessor, which is a textual substitution macro
language.
Well, the preprocessor is part of the language in a way. These two come
together.
No. In fact, these are even two different programs, see man cpp.
These two different programs come together.
Macros certainly aren't first class (you can't pass a macro to a
function, only its expansion).
In Haskell I cannot pass a function to a function, only its expansion.
What do you mean by "expansion"? Can you clarify this?
f1=\x->x+1
f2=\x->2*x
g=\x->x.f1
h=\x->x.(\x->x+1)
h is g
C does support function pointers, which are something like first class
functions. The main things C lacks which people associate with true
first-class function is:
The ability to construct anonymous/local functions.
If you look at the example you will see I've done that.
No. Your "compose" macro is not a function; for example, you can't use
it as an argument to itself (which is easy in Haskell: (.)(.))
Ok.
The ability to capture local variables and return a function with some
variables bound.
If I can construct "anonymous" functions and "constants", I can
construct
functions with some variables bound.
See above. You can't.
Ok.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe