A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/LW/html/lw-655.htm below:

rotate-ring

rotate-ring Summary

Rotates a ring, that is moves the insertion point.

Signature

rotate-ring ring how-many => object

Arguments

ring

A ring object created by make-ring.

how-many

A fixnum.

Values

object

A Lisp object.

Description

The function rotate-ring rotates the ring, that is it moves the insertion point "back", which is the same direction that ring-pop would progress.

how-many is the number of positions to rotate. It has to be a fixnum, but otherwise is not limited.

rotate-ring returns the element before the insertion point after the rotation (the one that (ring-ref ring 0) would return if called immediately after rotate-ring).

Examples

If the ring contains 3 elements or more, then

(progn
  (ring-pop ring
)
  (ring-pop ring
)
  (ring-ref ring
 0))

returns the same value as:

(rotate-ring ring 2)

but the second form does not remove an element from the ring, while the first form removes 2 elements.

LispWorks User Guide and Reference Manual - 20 Sep 2017


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4