Path: utzoo!attcan!uunet!husc6!uwvax!dogie!uwmcsd1!csd4.milw.wisc.edu!markh From: markh@csd4.milw.wisc.edu (Mark William Hopkins) Newsgroups: comp.lang.lisp Subject: Re: Functions vs. Procedures in Lisp Message-ID: <6035@uwmcsd1.UUCP> Date: 18 Jun 88 17:49:08 GMT References: <34296@linus.UUCP> <1350017@otter.hple.hp.com> <6024@uwmcsd1.UUCP> <51742@ti-csl.CSNET> Sender: daemon@uwmcsd1.UUCP Reply-To: markh@csd4.milw.wisc.edu (Mark William Hopkins) Organization: University of Wisconsin-Milwaukee Lines: 31 In article <51742@ti-csl.CSNET> gateley@mips.UUCP (John Gateley) writes: >In article <6024@uwmcsd1.UUCP> markh@csd4.milw.wisc.edu (Mark William Hopkins) writes: >>[Examples of side-effecting mathematics deleted] >>Conclusion: Mathematical functions and programming language functions are MUCH >>more closely related than anybody has realised up to now. > >I dont follow this, but if what you are saying is true, you should be able >to write a mathematical function with side effects. Show me how to do this. >I would like to see, for example, two functions f and g where g always returns >the last argument passed to f. > >John Gateley This is a tall order, but here it goes: Given a function f, let f' be the corresponding function defined on finite sequences: f'({x1, x2, ... , xn}) = {f(x1), f(x2), ... , f(xn)} Let F be an ordered pair (f', g) with f defined as above and g defined for sequences as follows: g({x1, x2, ... , xn}) = xn (Here's where the mathematical correlates of side-effects come in) "For brevity we will suppress the prime on f' unless confusion otherwise dictates, and we will refer to g as the 'last-argument' function of f." ... or something like that.