Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!hao!nbires!isis!dmiruke From: dmiruke@isis.UUCP (Dataram Miruke) Newsgroups: net.lang.c Subject: Re: lambda defs in C Message-ID: <314@isis.UUCP> Date: Thu, 6-Feb-86 23:45:37 EST Article-I.D.: isis.314 Posted: Thu Feb 6 23:45:37 1986 Date-Received: Sun, 9-Feb-86 08:27:09 EST References: <187@rexago1.UUCP> Distribution: net Organization: University of Denver Math and Computer Science Lines: 34 > 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 Don't the inline functions in C++ provide a similar feature? - Datta Miruke