Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!psuvax1!rutgers!uwvax!picard.cs.wisc.edu!quale From: quale@picard.cs.wisc.edu (Douglas E. Quale) Newsgroups: comp.lang.misc Subject: Re: On whether C has first-class composable functions Message-ID: <1991Jan19.210006.8112@spool.cs.wisc.edu> Date: 19 Jan 91 21:00:06 GMT References: <4408:Jan421:44:3391@kramden.acf.nyu.edu> <1991Jan13.045906.6210@spool.cs.wisc.edu> <301@smds.UUCP> Sender: quale@picard.cs.wisc.edu Organization: U of Wisconsin CS Dept Lines: 43 In article <301@smds.UUCP> sw@smds.UUCP (Stephen E. Witham) writes: >In article <1991Jan13.045906.6210@spool.cs.wisc.edu>, >quale@picard.cs.wisc.edu (Douglas E. Quale) is ostensibly writing about the >various simulations of composable functions that have been posted here. >He talks about: > 1) The evils of fixed-size tables, as in Kristoffer Eriksson's posting. > 2) The evils of non-portability (Mr. Eriksson mentioned doing something > non-portable). > 3) The problem that if you allocate something, you have to explicitly > free it in C. > 4) That the "compose" functions seen so far only work on one type of > function. They are not polymorphic. >Finally, he complains that... > 5) "Some people will use a hammer for anything, even driving screws." > >Numbers 1 and 2 have to do with Mr. Ericsson's posting, and not, as Mr. >Quale seems to think, the C language or composable functions. If you know a portable method implementation in C that removes the restriction to fixed size tables, post it. Mr. Eriksson said he *didn't* know a portable way to fix this problem in C, so it *is* a C language problem. > >Number 5 is nasty. First of all, it's not all that clumsy, although >it's not Scheme. But mainly, this is something we were specifically >challenged to do. Now you're making fun of us for trying?? Also, given >one language at a time to work with, if I'm driving more nails than screws, >I'll use the hammer language instead of the screw language. > Not all that clumsy is a value judgement that you are entitled to make, and I suppose then that I'm entitled to chuckle as well. (The C code is somewhat larger than (define (compose f g) (lambda (x) (f (g x)))), and I'd really like to see you prove that the C code works, and the C implementation does have 69 different arbitrary limits built in that don't exist in a lisp solution, but it's your call.) If you have to drive nails and screws, I'd use a language that provides a full toolkit instead of just a hammer. -- Doug Quale quale@picard.cs.wisc.edu