Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!hplabs!otter!psa From: psa@otter.hple.hp.com (Patrick Arnold) Newsgroups: comp.lang.lisp Subject: Re: Functions vs. Procedures in Lisp Message-ID: <1350017@otter.hple.hp.com> Date: 16 Jun 88 08:27:16 GMT References: <34296@linus.UUCP> Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 34 John Gately is quite right to point out that function has sevral meanings depending on the context of the conversation. I'm afraid it's one of my "religious beliefs" that functions are expressions which denote values and that calling a function with the same actual parameters will always produce the same result and will have no insidious effects on other parts of the system (i.e. side effects). This is the mathematical concept of a function. I am quite happy with the other use provided the meaning is agreed at the outset. I tend to use the term procedure for a parameterised piece of code which may return a value (or even many values) and may have side effects. This is sometimes a useful distinction to make. LISP and indeed most other languages don't support the real notion of a function because there is always the ability to access (and change destructively) other values or parameters. I hope this explanation gives you some hints as to why I don't think LISP has functions in the true sense (although you can write inefficient Lisp programs that are functional). First class procedures are a very powerful programming tool enabling the use of generic operations over data structures and object oriented style programming using procedures with local state (closures) as objects. There is quite heavy use of them in Abelson and Sussman (a must for any serious Lisp programmer) and the book illustrates their use in a number of different programming paradigms including an object oriented style. (Interesting that what Lisp like languages have been able to do for years is now in fashion in a different guise!!). By the way I would just like to say that I don't get anything for plugging Structure and Interpretation of Computer Programs, but it is quite the best book on Lisp (Scheme actually) in particular and some programing techniques in general that I have come across. Patrick.