Article View: comp.lang.misc
Article #2839Re: On whether C has first-class composable functions
From: Douglas E. Quale
Date: Mon, 11 Feb 1991 16:14
Date: Mon, 11 Feb 1991 16:14
36 lines
1977 bytes
1977 bytes
In article <6828:Feb906:14:3491@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>I never said that those expressions were nonsensical. Your implication
>is a lie, plain and simple. I doubt you have the integrity to review the
>articles and apologize, but I'll give you one chance to do so before I
>start quoting things in public.
>
Quote away, Dan. I'm not afraid of the truth.
>> Instead of continually saying it's trivial, post your compose code in C and
>> then we'll see how it stacks up.
>
>I did. Since you apparently would rather flame than think, here's the
>three-way composition that you claim to be so difficult. I've written it
>out step-by-step and put in comments just for you.
>
> compose(square,square,sqsq) /* put square o square in sqsq */
> compose(square,sqsq,sqsqsq) /* put square o sqsq in sqsqsq */
> printf("%d\n",apply(sqsqsq,2)); /* apply sqsqsq to 2 and print it */
>
>Exercise: write the missing struct fun definitions and initializations.
>
>---Dan
Dan, this is your job, not mine. I say it can't be done.
int square(int i) { return i*i; }
is easy enough, but I can't get the rest to work.
I keep getting a type clash in the second call to compose, since your
compose takes function pointers as arguments (I used &compose instead)
and returns a structure.
How about helping me out?
-- Doug Quale
Technical Details
Message-ID:
<1991Feb11.161423.9665@spool.cs.wisc.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!zazen!uwvax!picard.cs.wisc.edu!qualeReferences:
<25199:Feb801:33:1191@kramden.acf.nyu.edu> <1991Feb8.191014.6430@spool.cs.wisc.edu> <6828:Feb906:14:3491@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!elroy.jpl.nasa.gov!sdd.hp.com!uakari.primate.wisc.edu!zazen!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: <1991Feb11.161423.9665@spool.cs.wisc.edu> Date: 11 Feb 91 16:14:23 GMT References: <25199:Feb801:33:1191@kramden.acf.nyu.edu> <1991Feb8.191014.6430@spool.cs.wisc.edu> <6828:Feb906:14:3491@kramden.acf.nyu.edu> Sender: news@spool.cs.wisc.edu (The News) Organization: U of Wisconsin CS Dept Lines: 36