All Manuals > LispWorks User Guide and Reference Manual > 38 The HCL Package

NextPrevUpTopContentsIndex

ring-pop

Function
Summary

Removes an element from a ring and returns the element before the insertion point.

Package

hcl

Signature

ring-pop ring &optional remove => object

Arguments

ring

A ring object created by make-ring.

remove

A generalized boolean.

Values

object

A Lisp object.

Description

The function ring-pop removes (by default) an element from the ring and returns the element before the insertion point.

If remove is true then the element is removed from the ring. If remove is nil then the element remains and instead the 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.

Examples

These 3 forms all return the same values, but the first form removes an element from the 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))
See also

ring-push
make-ring
rotate-ring
ring-ref
ring-length


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex