Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!philapd!ssp9!dolf From: dolf@idca.tds.PHILIPS.nl (Dolf Grunbauer) Newsgroups: comp.lang.misc Subject: Re: Look, Ma, I can dynamically compose functions in C! Message-ID: <553@ssp9.idca.tds.philips.nl> Date: 21 Dec 90 11:48:00 GMT References: <20@garth.UUCP> <27534.276e5bd3@kuhub.cc.ukans.edu> <1990Dec19.222059.6878@mathrt0.math.chalmers.se> <19468:Dec2100:23:0790@kramden.acf.nyu.edu> Reply-To: dolf@idca.tds.philips.nl (Dolf Grunbauer) Organization: Philips Information Systems, Apeldoorn, The Netherlands Lines: 34 In article <19468:Dec2100:23:0790@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >X-Original-Subject: Re: Complexity of syntax > >In article <1990Dec19.222059.6878@mathrt0.math.chalmers.se> augustss@cs.chalmers.se (Lennart Augustsson) writes: >> To see the difference just try to write a function >> that does function composition. >> I claim that this is impossible to do in a portable way. > >Okay. (What follows isn't tested but you'll get the idea.) > >[ idea, which probably will work, deleted ] > I think this is not what Lennart wanted. He wanted something like: extern int f(), g(); int (*fg)(); ... fg = f; (*fg)(x); /* executes f(x) */ fg = compose (f,g); (*fg)(x); /* should execute f(g(x)) */ That is: he just wants to use the result of compose just like any other pointer to function, so one needs not to known whether it is a real function or a composed one. In Dan's code one must made this disctinction. By the way when reading Lennarts article, he gave me more or less the idea that this compising is possible in ALGOL68, but I am affraid it isn't. -- _ _ / U | Dolf Grunbauer Tel: +31 55 433233 Internet dolf@idca.tds.philips.nl /__'< Philips Information Systems UUCP ...!mcsun!philapd!dolf 88 |_\ If you are granted one wish do you know what to wish for right now ?