(defun (setf cadr) ...) to define a setf expansion function for cadr (although it may be much more convenient to use defsetf or define-modify-macro). If the optional documentation string doc-string is present, then it is attached to the name as a documentation string of type function; see documentation. If doc-string is not followed by a declaration, it may be present only if at least one form is also specified, as it is otherwise taken to be a form. It is an error if more than one doc-string is present. The forms constitute the body of the defined function; they are executed as an implicit progn. The body of the defined function is implicitly enclosed in a block construct whose name is the same as the name of the function. Therefore return-from may be used to exit from the function. Other implementation-dependent bookkeeping actions may be taken as well by defun. The name is returned as the value of the defun form. For example: ...
даже вот X3J13 voted in March 1989 to introduce the concept of a function-name, which may be either a symbol or a two-element list whose first element is the symbol setf and whose second element is a symbol. The primary purpose of this is to allow setf expander functions to be CLOS generic functions with user-defined methods.
Спасибо, так яснее. Ну в общем, видимо, я что-то не дописал, но не понимаю, что, т.к. редко общаюсь с fdefinition, и я думал, с ним не будет жаловаться.
Many places in Common Lisp that used to require a symbol for a function name are changed to allow 2-lists as well; for example, defun is changed so that one may write (defun (setf foo) ...), and the function special operator is changed to accept any function-name. See also fdefinition
а такой вопрос - у нас в CL есть какой-то канонический стандарт, который платный и рассылается в печатной версии. именно он считается эталоном, а не cltl2 или гиперспек?
By convention, any function named (setf f ) should return its first argument as its only value, in order to preserve the specification that setf returns its newvalue. See setf.
> По-моему оно вообще ничего не добавляет, но ладно.
The primary purpose of this is to allow setf expander functions to be CLOS generic functions with user-defined methods. — вот это предложение имел ввиду, а дальше просто cltl доцитировал
> По-моему оно вообще ничего не добавляет, но ладно.
The primary purpose of this is to allow setf expander functions to be CLOS generic functions with user-defined methods. — вот это предложение имел ввиду, а дальше просто cltl доцитировал
Ну очевидно, что тут вся проблема в том, что это defun, а не clos-овский метод.