Circular sequences


The circular vocabulary implements the Sequence protocol to allow an arbitrary start index and wrap-around indexing.

Creating a new circular object:
Image
<circular> ( seq -- circular )

Image
<circular-string> ( n -- circular )

Image
<growing-circular> ( capacity -- growing-circular )


Changing the start index:
Image
change-circular-start ( n circular -- )

Image
rotate-circular ( circular -- )


Pushing new elements:
Image
circular-push ( elt circular -- )

Image
growing-circular-push ( elt circular -- )


Iterating over a circular until a stop condition:
Image
circular-while ( ... circular quot: ( ... obj -- ... ? ) -- ... )

Image
circular-loop ( ... circular quot: ( ... obj -- ... ? ) -- ... )