v0.24.0
✨ New stuff
List and Array Zippers
A list/array zipper is a sequential data structure that tracks a single selected or focused item, and the sequence of items immediately to the left and right of the focused item. The list-based implementation allows efficient navigation to and modification of the focused item, and the items immediately to the left or right of the focus. A zipper is useful to doing contextual navigation and updates of sequential data, tracking a single selected item from a list of items, etc. A zipper gives you the ability to "look around" at nearby items when focused on some single item.
The following presentation gives a great overview of zippers, and some of theory behind them: http://data.tmorris.net/talks/zippers/0a1062fd0526d7ac1f41ade1e4db1465d311b4fd/zippers.pdf
This implementation was inspired by several existing implementations by mostly the Queensland Functional Programming Lab (qfpl)'s implementation here: https://github.com/qfpl/list-zipper
- Added
SequenceZipper
- a module functor that can be used to create a zipper using any data type that has aSEQUENCE
implementation (i.e.List
orArray
). - Added
ListZipper
a concrete zipper implementation backed by alist
- Added
ArrayZipper
a concrete zipper module backed by anarray
See the code for an overview of the functions available.
The ListZipper
is the preferred implementation because of it's ideal semantics with moving the focus left and right in O(1) time. An ArrayZipper
is also provided, but the performance characteristics are likely worse than the ListZipper
.