Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site iuvax.UUCP Path: utzoo!watmath!clyde!floyd!harpo!ihnp4!inuxc!iuvax!notes From: notes@iuvax.UUCP Newsgroups: net.emacs Subject: Re: Parameters and recursion - (nf) Message-ID: <318@iuvax.UUCP> Date: Wed, 11-Apr-84 01:02:39 EST Article-I.D.: iuvax.318 Posted: Wed Apr 11 01:02:39 1984 Date-Received: Thu, 12-Apr-84 04:45:42 EST Sender: notes@iuvax.UUCP Organization: Indiana University Lines: 20 #R:uo-vax1:-1020000200:iuvax:2300005:000:820 iuvax!unix68 Apr 10 18:22:00 1984 I remember figuring this one out when I first started writing mlisp code. The reason for the behaviour is that the passed arguments are not evaluated until the called function actually asks for them to be evaluated and they are then evaluated in the CALLED function's current environment rather than the CALLING function's environment. Since bar is a local variable, when (setq bar (arg 1 "bar? ")) is executed the second time, bar is 'lambda bound' to 0, and (arg 1 "bar? ") is the value of (- bar 1) IN THE CURRENT ENVIRONMENT RATHER THAN THE CALLING ENVIRONMENT and is thus equivalent to (- 0 1) or -1. I don't know whether this is considered a 'bug' or a 'feature', but I think that this is one of the things that got changed (to work the way you would expect) when the new, alternative, defun syntax was created.