Skip to content

Iterator

final class Iterator<Type> < DoubleStack<Type>

Stateful list, used as an iterator. An Iterator maintains a current position in the list, and offers insertions and deletions at that position, but insertion and deletion at any other position, including at the front and back.

Member Functions

Name Description
hasHere Is there an element at the current position?
hasBefore Is there an element before the current position?
front Get the first element.
back Get the last element.
here Get the element at the current position.
before Get the element before the current position.
pushFront Insert a new element at the start.
pushBack Insert a new element at the end.
pushHere Insert a new element at the current position.
pushBefore Insert a new element before the current position.
popFront Remove the first element and return it.
popBack Remove the last element and return it.
popHere Remove the element at the current position and return it.
popBefore Remove the element before the current position and return it.
next Move the current position forward one.
previous Move the current position backward one.
rewind Rewind the current position back to the start.

Member Fibers

Name Description
walk Forward iteration.

Member Function Details

back

function back() -> Type

Get the last element.

before

function before() -> Type

Get the element before the current position.

front

function front() -> Type

Get the first element.

hasBefore

function hasBefore() -> Boolean

Is there an element before the current position?

hasHere

function hasHere() -> Boolean

Is there an element at the current position?

here

function here() -> Type

Get the element at the current position.

next

function next()

Move the current position forward one.

popBack

function popBack() -> Type

Remove the last element and return it.

popBefore

function popBefore() -> Type

Remove the element before the current position and return it.

popFront

function popFront() -> Type

Remove the first element and return it.

popHere

function popHere() -> Type

Remove the element at the current position and return it.

previous

function previous()

Move the current position backward one.

pushBack

function pushBack(x:Type)

Insert a new element at the end.

  • x: Value.

pushBefore

function pushBefore(x:Type)

Insert a new element before the current position.

  • x: Value.

pushFront

function pushFront(x:Type)

Insert a new element at the start.

  • x: Value.

pushHere

function pushHere(x:Type)

Insert a new element at the current position.

  • x: Value.

rewind

function rewind()

Rewind the current position back to the start.

Member Fiber Details

walk

fiber walk() -> Type

Forward iteration.

Return: a fiber object that yields each element in forward order.