Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site rexago1.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!cwruecmp!rexago1!rich From: rich@rexago1.UUCP (K. Richard ) Newsgroups: net.lang.c Subject: lambda defs in C Message-ID: <187@rexago1.UUCP> Date: Wed, 5-Feb-86 12:39:53 EST Article-I.D.: rexago1.187 Posted: Wed Feb 5 12:39:53 1986 Date-Received: Fri, 7-Feb-86 20:37:06 EST Distribution: net Organization: Roadway Express Inc., Akron, OH Lines: 31 I often find myself creating highly localized register variables in an attempt to synthesize common sub expression optimization: { register char _q = *((x.y)->z); if (_q == 'a' || _q == 'b' || _q == 'c') { ... I also want to return values from arbitrary expressions like a for loop. Lisp has something called a lambda definition which is something like a local temporary function definition. Sort of like: if ( lambda int f(register char _q = *((x.y)->z)) { return(_q == 'a' || _q == 'b' || _q == 'c'); } /* end of lambda def */ ) { ... or x = lambda int f() { for (...) { ... return(some expression); ... } /* for */ } /* lambda */ So, academically, if we were to add a simlar feature to a new dialect of C, or to construct a pre-preprocessor for ansii C (a la C++), what problems do you see? K. Richard Magill