Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!adm!smoke!broome From: broome@smoke.brl.mil (Paul Broome) Newsgroups: comp.lang.c Subject: Re: function composition in C Message-ID: <15397@smoke.brl.mil> Date: 7 Mar 91 21:01:23 GMT References: <15357@smoke.brl.mil> <91060.132635REIDMP@MAINE.BITNET> <347@tslwat.UUCP> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 34 In article <347@tslwat.UUCP> louk@tslwat.UUCP (Lou Kates) writes: : :In article <91060.132635REIDMP@MAINE.BITNET> REIDMP@MAINE.BITNET (Reid M. Pinchback) writes: :>gwyn@smoke.brl.mil (Dough Gwyn) writes: >someone else wrote: :>* >I don't think anyone was saying your method was not valid, but functional :>* >composition returns a _function_ given two other functions. :> :>* Which makes this topic unsuitable for discussion in the C newsgroup. :>* In C, functions are always statically defined. :> :>Isn't it a bit abrupt to forestall questions in this manner? One of :>the joys of reading newsgroups like this is to have the chance to :>consider problems that we haven't thought of before; : :Perhaps we need to consider what you need to add to C to get :this with the minimal change to C. : :You should be able to do function composition in OO extensions to C... True function composition is associative. That is, compose(f,compose(g,h)) = compose(compose(f,g),h). A proposal for such extensions should consider whether this property will hold true. Function composition is a very powerful concept as it's a good way to control complexity. But to be useful for programming in C you'd have to preclude side effects. This would completely change the character of the language. Doug is right. The topic is not appropriate (although it is interesting!). One place to read more about it is in a recent book on Functional Programming by Richard Bird and Phil Wadler or in the group comp.lang.functional. -Paul