ch2_1_setf
This is an old revision of the document!
SETF
SETF
assigns values to places, accepts any number of arguments. The odd (first, third etc.) arguments, if they are not symbols, are evaled, but the result can represent place. The even (second, fourth etc.) arguments are evaled and the value is assigned to that place. The last set value is returned.
SETF
can be used just like SETQ
to assign values to symbols:
>(setf a 4) ; set value of symbol A, just like SETQ does 4
Places are returned from several accessor functions, like CAR
, CDR
etc.
>(setq li '(a b c)) ; prepare list LI for this example (A B C) >(setf (car li) 'd) ; access the CAR of the list LI D >li (D C B)
ch2_1_setf.1645357450.txt.gz · Last modified: 2022/02/20 04:44 by admin