- . get-setf-method get-setf-expansion, SETF-METHOD-VS-SETF-METHOD Writeup. , , get-setf-expansion. , . , .
nil, get-setf-expansion , nil:
(get-setf-expansion 'x)
;=> NIL, NIL, (#:G0001), (SETQ X #:G0001), X
? :
:
get-setf-expand &optional
& Rightarrow; vars, vals, store-vars, writer-form, reader-form
:
-.
environment - .
vars, vals, store-vars, writer-form, reader-form - setf.
5.1.1.2 Setf:
, , , let *, , .
( , ), , .
, , , .
, , , , setf.
, .
, ?
(get-setf-expansion 'x)
;β NIL, NIL, (#:G0001), (SETQ X #:G0001), X
x - , , . , , . - . , setf , . , . - (setq x #:g0001), , . x, , .
SBCL:
CL-USER> (defstruct person
person-name)
;β PERSON
CL-USER> (get-setf-expansion '(char (person-name (first (second list-of-list-of-persons))) 3))
; (
; ((PERSON-NAME (FIRST (SECOND LIST-OF-LIST-OF-PERSONS))))
; (
; (SB-KERNEL:%CHARSET
; (CHAR
, ,
(let* ((temp965 (person-name (first (second list-of-list-of-persons))))
(old-char (char tmp965 3))) ; optional
(setq new964 <compute-new-value>)
(sb-kernel:%charset tmp965 3 new964))
, ( <compute-new-value>), , ( ). , , new964 , -, ββ.
" " get-setf-expansion: