Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/guid75/ziplist

A simple Elm zipper implementation
https://github.com/guid75/ziplist

elm zipper

Last synced: 26 days ago
JSON representation

A simple Elm zipper implementation

Awesome Lists containing this project

README

        

# ziplist

A ZipList is a type of collection in which you can move a pointer on a current element forwards or backwards.

Here is a simple example:

```elm
import ZipList exposing (..)

zlist : ZipList.ZipList Number
zlist = ZipList.fromList [1, 2, 3] -- this ziplist points on the first element (1) after creation

a : Maybe Number
a = ZipList.current zlist -- worth Just 1

b : Maybe Number
b =
zlist
|> ZipList.forward
|> ZipList.forward
|> ZipList.current -- worth Just 3

list = ZipList.toList zlist -- worth [1, 2, 3]
```