Path: utzoo!utgpu!water!watmath!clyde!bellcore!tness7!tness1!sugar!ficc!peter From: peter@ficc.UUCP (Peter da Silva) Newsgroups: comp.lang.c Subject: Anonymous Functions. Message-ID: <791@.UUCP> Date: 18 May 88 15:00:49 GMT References: <12074@tut.cis.ohio-state.edu>, <10716@steinmetz.ge.com> <778@.UUCP> Organization: SCADA Lines: 42 Reposted because news wasn't getting off-site. My fault. In article <282@teletron.UUCP>, andrew@teletron.UUCP (Andrew Scott) writes: > The { .. } syntax for aggregate declar- > ations seems natural enough to use for unnamed aggregates, but how would it > be done for functions? (lambda nil (... Just kidding. How about: a = (int ()(int i)) { for(i=0; i < 10; i++) if(foo(i)==MAGIC) break; return i; }(b); And again: int (*f)(int) = &(int ()(int i)) { ... }; a = (*f)(b); Yow! Auto functions! Back to BCPL. But I think it's neat. In article <2706@geac.UUCP>, daveb@geac.UUCP (David Collier-Brown) writes: > | In article <11325@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > qsort(base, nel, width, compar) > char *base; > int (*compar)(); > EXAMPLE > qsort(base, nel, width, { return zcomp($1,$2) }); qsort(base, nel, width, &(int ()(int a, b)){ return zcomp(a, b); } ); > Note the problem with parameters... I'm actually beginning to like this syntax. Is this a fatal character flaw? -- -- Peter da Silva, Ferranti International Controls Corporation. -- Phone: 713-274-5180. Remote UUCP: uunet!nuchat!sugar!peter.