Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!unmvax!deimos.cis.ksu.edu!rutgers!okstate!norman From: norman@a.cs.okstate.edu (Norman Graham) Newsgroups: comp.lang.misc Subject: Re: first class functions (opps) Message-ID: <4663@okstate.UUCP> Date: 9 May 89 16:12:38 GMT References: <451@sdti.SDTI.COM> Organization: Oklahoma State Univ., Stillwater Lines: 34 From article <451@sdti.SDTI.COM>, by turner@sdti.SDTI.COM (Prescott K. Turner): > But isn't it false advertising to claim first-class functions unless you > can compare functions for equality just like other types? No. It is false advertising to claim first-class functions if (1) you can define a magical function-equality algorithm but (2) your language doesn't allow you to pass functions to a functional abstration of your magical function-equality algorithm. Of course, there are many other things that prevent functions from being first-class, but the requirement that all relations be defined for functions is not among them. In general, values of type 'alpha' (in this case, 'alpha' = 'function') are first-class citizens of a language when that language does not discriminate against them in any way. Reynolds [*] called this the 'Principle of Data Type Completeness' and in particluar it requires that all values (reguardless of type) be (1) passable as parameters, (2) assignable, (3) able to form components of data structures, and (4) able to be returned from functions. Of course, whether any particular function has values of type 'function' in its domain or codomain is still up to the definition of the function and has no bearing on the first-classness of values of type 'function'. [*] J. C. Reynolds, GEDANKEN: a simple typeless language based on the principles of completeness and the reference concept, CACM, vol. 13 (5), 308-319 (1970). -- Norman Graham Oklahoma State University Internet: norman@a.cs.okstate.edu Computing and Information Sciences UUCP: {cbosgd, rutgers} 219 Mathematical Sciences Building !okstate!norman Stillwater, OK 74078-0599