Removes an element from a ring and returns the element before the insertion point.
hcl
ring-pop ring &optional remove => object
ring⇩ |
A ring object created by make-ring. |
remove⇩ |
A generalized boolean. |
object |
A Lisp object. |
The function ring-pop
removes (by default) an element from ring and returns the element before the insertion point.
If remove is true then the element is removed from ring. If remove is nil
then the element remains and instead ring is rotated by 1 as if by (rotate-ring ring 1)
. The default value of remove is t
.
ring-pop
signals an error when called on an empty ring.
These 3 forms all return the same values, but the first form removes an element from a ring, while the other two leave all the elements in the ring:
(values (ring-pop ring) (ring-ref ring 0))
(values (ring-pop ring t) (ring-ref ring 0))
(values (ring-ref ring 0) (rotate-ring ring 1))
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35