(defmethod p-nreverse ((object persistent-cons))
(let* ((previous object)
(current (p-cdr previous)))
(setf (p-cdr previous) '())
(loop until (p-endp current)
do (let ((next (p-cdr current)))
(setf (p-cdr current) previous
previous current
current next)))
previous))
Source Context