Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tektronix!sequent!mntgfx!franka From: franka@mentor.com (Frank A. Adrian) Newsgroups: comp.lang.misc Subject: Re: The Fundamental Concept of Programming language X Keywords: programming languages, abstractions Message-ID: <1990Jan13.152226.4722@mentor.com> Date: 13 Jan 90 15:22:26 GMT References: <1470@mdbs.UUCP> <1782@aipna.ed.ac.uk> <2886@water.waterloo.edu> <1532@castle.ed.ac.uk> <666@s5.Morgan.COM> <32824@news.Think.COM> Reply-To: franka@mntgfx.UUCP (Frank A. Adrian) Organization: /etc/organization Lines: 42 In article <32824@news.Think.COM> barmar@think.com (Barry Margolin) writes: >In article <666@s5.Morgan.COM> amull@Morgan.COM (Andrew P. Mullhaupt) writes: >>In article <1532@castle.ed.ac.uk>, nick@lfcs.ed.ac.uk (Nick Rothwell) writes: >>> Why are "operators" different to functions? >>They can have functions as arguments. >... >>Functions, therefore, are not 'first class data' since the functions >>which operate on them are not functions. (This is a lot like Lisp). > >Lisp doesn't have the distinction between functions and operators. In >Lisp, functions can take functions as arguments and return them as values. >For instance, in Common Lisp one can write: > >(defun complement (function) > #'(lambda (&rest args) > (not (apply function args)))) > >(complement ) returns a function that returns true when the >original function returns false, and vice versa (this function will be part >of ANSI Common Lisp). One could then write: > >(setf (symbol-function 'nequal) (complement #'equal)) > >or > >(funcall (complement #'member) 'foo *some-list*) > Not to dispute Barry's assertion, because, as he states, one CAN pass and return functions in CL, but one still has to use the clunky (function ...) special form and usually one of the (funcall ...) or (apply ...) functions. This does make handling functional slots in function calls non-symmetrical with respect to data slots. I much prefer Scheme's symmetric handling of all slots in a function call. By the way, this seems to arise in CL due to the use of a different value cell for the functional binding of an identifier. Can somebody tell me where this differentiation arose and why? -- Frank A. Adrian Mentor Graphics, Inc. franka@mntgfx.com