define-setf-expander
(define-setf-expander name lambda-list body...)
Defines how (setf (name args...) value) expands. The body (a macro-style form builder, usually with backquote) is run at expansion time with the lambda list bound to the place's argument forms, and must return the five setf-expansion values with values: the temporary variables, their value forms, the store variables, the store form, and the access form. An &environment parameter is accepted and bound to nil, and get-setf-expansion is available to expand a sub-place. Works on every backend (the compilers run the expander at compile time). setf template symbols resolve in the defining package, like a defmacro. When name is also a macro, setf takes the expander, not the macro's expansion, and so does a setf of a symbol-macrolet name whose expansion is such a call. incf, decf, push, pushnew and pop read a place name makes through the access form, so the place needs no function of the same name; rotatef, shiftf, psetf, remf and a define-modify-macro still read it by calling name.