Xref: utzoo comp.lang.c:36477 comp.lang.functional:651 comp.theory:1577 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!felix.ee.mu.OZ.AU!aet From: aet@felix.ee.mu.OZ.AU (bert) Newsgroups: comp.lang.c,comp.lang.functional,comp.theory,aus.flame Subject: function composition in C Message-ID: <6873@munnari.oz.au> Date: 25 Feb 91 05:21:30 GMT Sender: news@cs.mu.oz.au Reply-To: aet@felix.ee.mu.OZ.AU (bert) Organization: Dept. of Electrical Engineering, University of Melbourne Lines: 19 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. Brought to you by Super Global Mega Corp .com