This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Per Bothner <bothner@cygnus.com> writes: > > I think Common Lisp defines it as something like > > > > `((setter f) ,@args value) > > that is, the value is the last argument to the setter function. > > Nope. The new value is the first argument to the stter function > in Common Lisp, as in Kawa, and for the same reason: The need > to handle functions that take optional, keyword, or rest parameters. I agree that using the value as the first parameter is easier. But CLtL2 says on pages 146: (defsetf access-fn update-fn [docstring]) The UPDATE-FN must name a function (or macro) that takes one more argument than ACCESS-FN takes. When `setf' is given a place that is a call on ACCESS-FN, it expands into a call to UPDATE-FN that is given all the arguments to ACCESS-FN and also, as its last argument, the new value (which must be returned by UPDATE-FN as its value). This (and the following example) is where I got the idea that the value comes last. > It is easy to prepend an extra required parameter as the new > first parameter to an existing parameter list; appending a new > argment at the end of a parameter list is much messier, in both > Lisp and Scheme. Yes, but this re-shuffling of arguments happens at macro-expansion time, no?