User Tools


Macro PUSH

Syntax

  • push item placenew-place-value

Arguments and Values

Description

push prepends item to the list that is stored in place, stores the resulting list in place, and returns the list.

For information about the evaluation of subforms of place, \seesection\GenRefSubFormEval.

Examples

(defparameter *list-in-list* '(nil))

*LIST-IN-LIST*

(push 1 (car *list-in-list*))

(1)

*list-in-list*

((1))

(push 1 (car *list-in-list*))

(1 1)

*list-in-list*

((1 1))

(defparameter *x* '(a (b c) d))

*X*

(push 5 (cadr *x*))

(5 B C)

*x*

(A (5 B C) D)

Side Effects

The contents of place are modified.

Affected By

None.

Exceptional Situations

None.

See Also

pop, pushnew, {\secref\GeneralizedReference}

Example Implementation

To be done.

The effect of (push item place) is equivalent to

(setf place (cons item place))

except that the subforms of place are evaluated only once, and item is evaluated before place.

Notes

None.

\issue{PUSH-EVALUATION-ORDER:FIRST-ITEM} \issue{DOTTED-LIST-ARGUMENTS:CLARIFY}