User Tools


Macro POP

Syntax

  • pop placeelement

Arguments and Values

Description

pop reads the value of place, remembers the car of the list which was retrieved, writes the cdr of the list back into the place, and finally yields the car of the originally retrieved list.

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

Examples

(defparameter *stack* '(a b c))

*STACK*

(pop *stack*)

A

*stack*

(B C)

(defparameter *list-in-list* '((1 2 3 4)))

*LIST-IN-LIST*

(pop (car *list-in-list*))

1

*list-in-list*

((2 3 4))

Side Effects

The contents of place are modified.

Affected By

None.

Exceptional Situations

None.

See Also

push, pushnew, {\secref\GeneralizedReference}

Example Implementation

To be done.

The effect of (pop place) is roughly equivalent to

(prog1 (car place) (setf place (cdr place)))

except that the latter would evaluate any subforms of place three times, while pop evaluates them only once.

Notes

None.

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