User Tools

Site Tools


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, and the result should 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)

Accessor functions in LabLISP are only the list-related functions: all the CAR, CDR combinations, the FIRST to TENTH, REST, NTH and NTHCDR.

ch2_1_setf.1645357847.txt.gz · Last modified: 2022/02/20 04:50 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki