Macro: P-PUSH

Documentation

Push ITEM onto the persistent list specified by PLACE. Return the modified persistent list. ITEM is evaluated before place.

Source

(defmacro p-push (item place &environment env)
  "Push ITEM onto the persistent list specified by PLACE.  Return the
modified persistent list. ITEM is evaluated before place."
  (multiple-value-bind (dummies vals newval setter getter)
      (get-setf-expansion place env)
    (let ((item-var (gensym "ITEM")))
      `(let* ((,item-var ,item)
              ,@(mapcar #'list dummies vals)
              (,(car newval) (p-cons ,item-var ,getter)))
         ,setter))))
Source Context