function composition in C
Aamod Sane
sane at cs.uiuc.edu
Tue Feb 26 10:45:41 AEST 1991
aet at felix.ee.mu.OZ.AU (bert) writes:
> 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.
Write to comp.lang.misc. There was recently a major war on this..
--
sane at cs.uiuc.edu
== / \
----- == * \_/ -|||-
==
More information about the Comp.lang.c
mailing list