function composition in C
bert
aet at felix.ee.mu.OZ.AU
Mon Feb 25 16:21:30 AEST 1991
Does anyone know how to write a compose function in C,
without writing a Scheme interpreter to do it in.
A call should look something like this:
(compose(sqr,cube)) (2)
which would evaluate to 64.
"compose" is a one-liner in any functional language,
but I suspect that it is, given the above constraint, impossible in C.
(then again, I'm just an undergrad, so what would I know :-)
Feel free to use pointers wherever they seem appropriate.
(so the above call could look like:
(*compose(&sqr,&cube)) (2) )
Many thanks for everyone's helpful comments!
Bert Thompson.
More information about the Comp.lang.c
mailing list