Swapping places
The naive way to swap the values of two places, a and b, is something like this:
;; BOGUS (setf temp a) (setf a b) (setf b temp)
psetf (parallel setf) can do it in one form:
(psetf a b b a)
But rotatef is best:
(rotatef a b)
The naive way to swap the values of two places, a and b, is something like this:
;; BOGUS (setf temp a) (setf a b) (setf b temp)
psetf (parallel setf) can do it in one form:
(psetf a b b a)
But rotatef is best:
(rotatef a b)