ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  5 Data and Control Flow   5.1 Generalized Reference   5.1.1 Overview of Places and Generalized Reference   5.1.1.2 Setf Expansions

5.1.1.2.1 Examples of Setf Expansions

Examples of the contents of the constituents of setf expansions follow.

For a variable x:

Sample Setf Expansion of a Variable
() ;list of temporary variables
() ;list of value forms
(g0001) ;list of store variables
(setq x g0001) ;storing form
x ;accessing form

For (car exp):

Sample Setf Expansion of a CAR Form
(g0002) ;list of temporary variables
(exp) ;list of value forms
(g0003) ;list of store variables
(progn (rplaca g0002 g0003) g0003) ;storing form
(car g0002) ;accessing form

For (subseq seq s e):

Sample Setf Expansion of a SUBSEQ Form
(g0004 g0005 g0006) ;list of temporary variables
(seq s e) ;list of value forms
(g0007) ;list of store variables
(progn (replace g0004 g0007 :start1 g0005 :end1 g0006) g0007)
;storing form
(subseq g0004 g0005 g0006) ; accessing form

In some cases, if a subform of a place is itself a place, it is necessary to expand the subform in order to compute some of the values in the expansion of the outer place. For (ldb bs (car exp)):

Sample Setf Expansion of a LDB Form
(g0001 g0002) ;list of temporary variables
(bs exp) ;list of value forms
(g0003) ;list of store variables
(progn (rplaca g0002 (dpb g0003 g0001 (car g0002))) g0003)
;storing form
(ldb g0001 (car g0002)) ; accessing form


Home Previous Up Next Table of Contents Index
© Franz Inc. All Rights Reserved - File last updated 2022-07-25