guid75 / ziplist / ZipList

A ZipList is a collection which can be moved forward/backward and that exposes a single current element

ZipLists


type ZipList a

A collection data type that can be moved forward/backward and that exposes a current element (see the current function)

Creation

fromList : List a -> ZipList a

Craft a new ZipList out of a List

singleton : a -> ZipList a

Create a new ZipList with a single element in it

Consultation

current : ZipList a -> Maybe a

Return the current element of a ZipList. Nothing will be returned if the ziplist is empty

toList : ZipList a -> List a

Convert a ZipList into a List

length : ZipList a -> Basics.Int

Return a ZipList length

Moving

forward : ZipList a -> ZipList a

Move forward a ZipList

backward : ZipList a -> ZipList a

Move backward a ZipList