Pop an item from the persistent list specified by PLACE.
(defmacro p-pop (place &environment env)
"Pop an item from the persistent list specified by PLACE."
(multiple-value-bind (dummies vals new setter getter)
(get-setf-expansion place env)
`(let* (,@(mapcar #'list dummies vals) (,(car new) ,getter))
(prog1 (p-car ,(car new))
(setq ,(car new) (p-cdr ,(car new)))
,setter))))
Source Context