Article View: comp.lang.misc
Article #2606Re^2: On whether C has first-class composable functions
From: Ken Dickey
Date: Mon, 07 Jan 1991 03:47
Date: Mon, 07 Jan 1991 03:47
66 lines
3501 bytes
3501 bytes
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>In article <442@data.UUCP> kend@data.UUCP (Ken Dickey) writes:
>> There is an important property of "first-class" objects missing here.
>> A first-class object does not have to be named.
>Do you have a reference? As always, I'm doing my best to use standard
>terminology; I just haven't seen any references that demand a syntactic
>restriction like that.
I believe that most references come from the Scheme literature.
The reference you want is Guy Steele's Masters thesis: "RABBIT: A
Compiler for SCHEME (A Study in Compiler Optimization)", MIT tech.
report: AI-TR-474, (May 1978). [I suspect earlier references, but
have not yet found them]. From the introduction (pg 8):
SCHEME also permits the treatment of functions as full flegded data
objects; they may be passed as arguments, returned as values, made
part of composite data structures, and notated as independent, unnamed
("anonymous") entities. {Contrast this with most ALGOL-like
languages, in which a function can be written only by declaring it and
giving it a name; imagine being able to use an integer value only by
giving it a name in a declaration!).
More recently, [Kent Dybvig, "The Scheme Programming Language",
Prentice Hall, 1987]
...procedures are not always named. Instead, procedures are
first-class data objects similar to strings or numbers; identifiers
are bound to procedures in the same way they are bound to other
objects.
I can dredge up more references if you like (most are at work and I am
at home).
>> By the way, what function would "apply(compose(compose,f),x);" return in C?
>> Strike "composable"?
>What are you talking about?
I admit that my C syntax is a bit rusty.
>It doesn't make sense to compose a function
>that takes two arguments, at least not without a more general notation.
>I can't make heads or tails of your example.
Why should the number of arguments make a difference to composability?
One should certainly be able to compose the function COMPOSE! {After
all it is a function, yes?} So a composition of COMPOSE should be a
function.
So compose(compose,f) should return a function which takes another
function argument [e.g. x] and returns a function which takes, say, 2
arguments. So I should be able to do something like compose the 2
functions, compose and f, to another function, x, to further
arguments: compose(compose,f)(x)(y,z). C is rather weak, and I
presumed that you would need a help function, APPLY, to do this.
-Ken
[Someone else's signature, but it expresses the situation:]
= The C Programming Language -- A language which combines the =
= flexibility of assembly language with the power of assembly language. =
Technical Details
Message-ID:
<443@data.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!zephyr.ens.tek.com!tektronix!percy!data!kendReferences:
<1990Dec29.110202.3862@mathrt0.math.chalmers.se> <17557:Jan219:22:3191@kramden.acf.nyu.edu> <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!ogicse!zephyr.ens.tek.com!tektronix!percy!data!kend From: kend@data.UUCP (Ken Dickey) Newsgroups: comp.lang.misc Subject: Re^2: On whether C has first-class composable functions Message-ID: <443@data.UUCP> Date: 7 Jan 91 03:47:30 GMT References: <1990Dec29.110202.3862@mathrt0.math.chalmers.se> <17557:Jan219:22:3191@kramden.acf.nyu.edu> <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> Organization: Microcosm, Beaverton, OR Lines: 66