File: ring.el.html
This code defines a ring data structure. A ring is a
(hd-index length . vector)
list. You can insert to, remove from, and rotate a ring. When the ring
fills up, insertions cause the oldest elts to be quietly dropped.
In ring-ref, 0 is the index of the newest element. Higher indexes correspond to older elements; when the index equals the ring length, it wraps to the newest element again.
hd-index = vector index of the oldest ring item.
Newer items follow this item; at the end of the vector,
they wrap around to the start of the vector.
length = number of items currently in the ring.
This never exceeds the length of the vector itself.
These functions are used by the input history mechanism, but they can be used for other purposes as well.
Defined variables (0)
Defined functions (22)
make-ring | (SIZE) |
ring-convert-sequence-to-ring | (SEQ) |
ring-copy | (RING) |
ring-elements | (RING) |
ring-empty-p | (RING) |
ring-extend | (RING X) |
ring-index | (INDEX HEAD RINGLEN VECLEN) |
ring-insert | (RING ITEM) |
ring-insert+extend | (RING ITEM &optional GROW-P) |
ring-insert-at-beginning | (RING ITEM) |
ring-length | (RING) |
ring-member | (RING ITEM) |
ring-minus1 | (INDEX VECLEN) |
ring-next | (RING ITEM) |
ring-p | (X) |
ring-plus1 | (INDEX VECLEN) |
ring-previous | (RING ITEM) |
ring-ref | (RING INDEX) |
ring-remove | (RING &optional INDEX) |
ring-remove+insert+extend | (RING ITEM &optional GROW-P) |
ring-resize | (RING SIZE) |
ring-size | (RING) |