A special case of Zipper3.SelectList.Zipper where all elements have the same type.
If you're working with Chars, check out Zipper.StringStringString
Zipper.ListListList.AdvancedZipper.StringStringPassed to the user-provided function by indexedMap and similar functions to specify the current element's location relative to the selected element
Create an empty zipper
empty --> ( [], [], [] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
--> ( [ 3, 2, 1 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )( [ 3, 2, 1 ], [ 7, 8, 9 ] )
|> fromZipperListList [4, 5, 6]
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )( [ 3, 2, 1 ], 5, [ 7, 8, 9 ] )
|> fromZipperListElemList (\n -> [4, n, 6])
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> toTuple
--> ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> toList
--> [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> toZipperListList
--> ( [ 3, 2, 1 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> toZipperListElemList List.sum
--> ( [ 3, 2, 1 ], 15, [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> length
--> 9fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> positionLeft
--> 3fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> positionRight
--> 6fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> getLeft
--> [ 1, 2, 3 ]fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> getSelected
--> [ 4, 5, 6 ]fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> getRight
--> [ 7, 8, 9 ]fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> setLeft [ 11, 12, 13 ]
--> fromTuple ( [ 11, 12, 13 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> setSelected [ 14, 15, 16 ]
--> fromTuple ( [ 1, 2, 3 ], [ 14, 15, 16 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> setRight [ 17, 18, 19 ]
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 17, 18, 19 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> map ((+) 10)
--> fromTuple ( [ 11, 12, 13 ], [ 14, 15, 16 ], [ 17, 18, 19 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> indexedMap (\{ first, leftEdge } val -> first * 100 + leftEdge * 10 + val)
--> fromTuple ( [ 1, 112, 223 ], [ 304, 415, 526 ], [ 607, 718, 829 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> update (\elems -> 0 :: elems)
--> fromTuple ( [ 0, 1, 2, 3 ], [ 0, 4, 5, 6 ], [ 0, 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> updateLeft (\elems -> 0 :: elems)
--> fromTuple ( [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> updateSelected (\elems -> 0 :: elems)
--> fromTuple ( [ 1, 2, 3 ], [ 0, 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> updateRight (\elems -> 0 :: elems)
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 0, 7, 8, 9 ] )fromTuple ( [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10, 11, 12 ] )
|> filter (modBy 2 >> (==) 0)
--> fromTuple ( [ 2, 4 ], [ 6, 8 ], [ 10, 12 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> indexedFilter (\{ section, rightEdge } val -> section == Left || rightEdge == 0 || val == 7)
--> fromTuple ( [ 1, 2, 3 ], [ 6 ], [ 7, 9 ] )
fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> indexedFilter (\{ leftEdge, rightEdge } val -> leftEdge == 0 || rightEdge == 0)
--> fromTuple ( [ 1, 3 ], [ 4, 6 ], [ 7, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> move MoveLeft MoveLast
--> Just (fromTuple ( [ 1, 2 ], [ 3, 4, 5, 6, 7, 8, 9 ], [] ))fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertFirst 0
--> fromTuple ( [ 0, 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertLast 0
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9, 0 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertLeftOfLeftSplit 0
--> fromTuple ( [ 1, 2, 3, 0 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertRightOfLeftSplit 0
--> fromTuple ( [ 1, 2, 3 ], [ 0, 4, 5, 6 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertLeftOfRightSplit 0
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6, 0 ], [ 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> insertRightOfRightSplit 0
--> fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 0, 7, 8, 9 ] )fromTuple ( [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
|> reverse
--> fromTuple ( [ 9, 8, 7 ], [ 6, 5, 4 ], [ 3, 2, 1 ] )zipper : Zipper Int
zipper = ( [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] )
indexRelativeLeftToAbsolute zipper (LeftIndex 2) --> 0
indexRelativeLeftToAbsolute zipper (LeftIndex 0) --> 2
indexRelativeLeftToAbsolute zipper (RightIndex 0) --> 3
indexRelativeLeftToAbsolute zipper (RightIndex 2) --> 5
indexRelativeLeftToAbsolute zipper (RightIndex 3) --> 6
indexRelativeLeftToAbsolute zipper (RightIndex 5) --> 8zipper : Zipper Int
zipper = ( [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] )
indexRelativeRightToAbsolute zipper (LeftIndex 5) --> 0
indexRelativeRightToAbsolute zipper (LeftIndex 3) --> 2
indexRelativeRightToAbsolute zipper (LeftIndex 2) --> 3
indexRelativeRightToAbsolute zipper (LeftIndex 0) --> 5
indexRelativeRightToAbsolute zipper (RightIndex 0) --> 6
indexRelativeRightToAbsolute zipper (RightIndex 2) --> 8
A list type that tracks two split locations