CarCache.CircularZipperList (CarCache v0.1.1) View Source

A simple functional zipper list used to approximate a circular buffer.

Based on: https://ferd.ca/yet-another-article-on-zippers.html

Link to this section Summary

Functions

Insert a value before the current cursor and set the cursor to the new value

Get the length of the entire list

Create a new/empty circular zipper list

Move the cursor to the next item in the list

Move the cursor to the previous item in the list

Remove the value at the current cursor

Replace the value at the current cursor

Get the value at the current cursor

Link to this section Types

Link to this section Functions

Specs

insert(t(), any()) :: t()

Insert a value before the current cursor and set the cursor to the new value

Specs

len(t()) :: non_neg_integer()

Get the length of the entire list

Specs

new() :: t()

Create a new/empty circular zipper list

Specs

next(t()) :: t()

Move the cursor to the next item in the list

Specs

prev(t()) :: t()

Move the cursor to the previous item in the list

Specs

remove(t()) :: t()

Remove the value at the current cursor

Specs

replace(t(), any()) :: t()

Replace the value at the current cursor

Specs

value(t()) :: any()

Get the value at the current cursor