[{"name":"Tape","comment":" A linear structure with a cursor pointing to some specific element. Tapes cannot be empty.\n\n@docs Tape\n\n\n## Create\n\n@docs create, fromList, fromListOrDefault, fromParts, singleton, repeat, range\n\n\n## Move operations\n\n@docs read, write, advance, rewind, left, right, undo, redo\n\n\n## Advanced move operators\n\n@docs How, leftWith, rightWith, tryLeft, tryRight, pushLeft, pushRight\n\n\n## Mapping\n\n@docs map, map2, map3, map4, map5, indexedMap, positionalMap\n\n\n## Transforms\n\n@docs reverse, sort, sortBy, sortWith, intersperse\n\n\n## Sub-tapes\n\n@docs Direction, select, update, take, filter\n\n\n## Deconstruction\n\n@docs unzip, parts\n\n\n## Conversions\n\n@docs toList, show\n\n\n## Summarizing and folding\n\n@docs foldr, foldl, reduce, maximum, minimum, sum, product, all, any\n\n\n## Properties\n\n@docs length, position, member, isEmptyLeft, isEmptyRight, elemIndex\n\n","unions":[{"name":"Direction","comment":" The direction enum selects parts of the tape that shall be extracted/modified.\n\nEach function might interpret each direction slightly differently. Check the\ndocumentation for more details.\n\n","args":[],"cases":[["Left",[]],["Right",[]],["LeftTail",[]],["Backwards",[]],["BackwardsTail",[]],["RightTail",[]],["Head",[]],["Tails",[]],["InsideOut",[]],["All",[]]]},{"name":"How","comment":" Declare how to move in the tape.\n","args":["a"],"cases":[["Cycle",["Basics.Int"]],["Default",["( a, Basics.Int )"]],["Condition",["a -> Basics.Bool"]],["Carry",["Basics.Int"]]]},{"name":"Tape","comment":" Base iterator type\n","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"advance","comment":" Advance tape to the last element\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> advance\n        |> show identity\n        --> \"[ a, b, c, d, => e ]\"\n\n","type":"Tape.Tape a -> Tape.Tape a"},{"name":"all","comment":" Determine if all elements satisfy some test.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> all (\\x -> String.length x < 2)\n        --> True\n\n","type":"(a -> Basics.Bool) -> Tape.Tape a -> Basics.Bool"},{"name":"any","comment":" Determine if any element satisfy some test.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> any (\\x -> x == \"e\")\n        --> True\n\n","type":"(a -> Basics.Bool) -> Tape.Tape a -> Basics.Bool"},{"name":"create","comment":" Create a tape from the left, head, and right parts.\n\nThe tape is conceptually equivalent to the list `left ++ [head] ++ right`\nand has a cursor that points to the tape head.\n\n    create [ \"a\", \"b\" ] \"c\" [ \"d\", \"e\" ]\n        |> show identity\n        --> \"[ a, b, => c, d, e ]\"\n\n","type":"List.List a -> a -> List.List a -> Tape.Tape a"},{"name":"elemIndex","comment":" Return index of element in tape\n\nElements left of head have negative indexes.\n\n","type":"a -> Tape.Tape a -> Maybe.Maybe Basics.Int"},{"name":"filter","comment":" Filter the given selection of tape with predicate.\n\nFilter never removes the head, which makes `filter Head` a no-op and\n`filter DirectoinTail` and `filter Direction` equivalent.\n\nIf you want to filter the head, convert to a list before\n\n","type":"Tape.Direction -> (a -> Basics.Bool) -> Tape.Tape a -> Tape.Tape a"},{"name":"foldl","comment":" Reduce a tape from the left.\n\nIt has the same effect as reducing the equivalent list.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> foldl (++) \"$\"\n        --> \"edcba$\"\n\n","type":"(a -> b -> b) -> b -> Tape.Tape a -> b"},{"name":"foldr","comment":" Reduce a tape from the right.\n\nIt has the same effect as reducing the equivalent list.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> foldr (++) \"$\"\n        --> \"abcde$\"\n\n","type":"(a -> b -> b) -> b -> Tape.Tape a -> b"},{"name":"fromList","comment":" Try to create tape from List. Empty lists return Nothing.\n\n    (fromList [ 1, 2, 3 ]\n        |> Maybe.map toList)\n        --> Just [ 1, 2, 3 ]\n\n","type":"List.List a -> Maybe.Maybe (Tape.Tape a)"},{"name":"fromListOrDefault","comment":" Create a tape from List or a singleton tape with the given default value.\n\n    fromListOrDefault 0 [ 1, 2, 3 ]\n        |> toList\n        --> [ 1, 2, 3 ]\n\n","type":"a -> List.List a -> Tape.Tape a"},{"name":"fromParts","comment":" Construct tape from left and right tails.\n\n    fromParts (tail Left tape) (head tape) (tail Right tape) ==> tape\n\n","type":"List.List a -> a -> List.List a -> Tape.Tape a"},{"name":"indexedMap","comment":" Same as map but the function is also applied to the index of each element.\n\nThe head has an index of zero and the left hand side of the tape is indexed with\nnegative numbers.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> indexedMap (\\i x -> String.fromInt i ++ x)\n        |> show identity\n        --> \"[ -2a, -1b, => 0c, 1d, 2e ]\"\n\n","type":"(Basics.Int -> a -> b) -> Tape.Tape a -> Tape.Tape b"},{"name":"intersperse","comment":" Places the given value between all members of the given tape.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> intersperse \"x\"\n        |> show identity\n        --> \"[ a, x, b, x, => c, x, d, x, e ]\"\n\n","type":"a -> Tape.Tape a -> Tape.Tape a"},{"name":"isEmptyLeft","comment":" True if tape has no elements to the left o head\n","type":"Tape.Tape a -> Basics.Bool"},{"name":"isEmptyRight","comment":" True if tape has no elements to the right o head\n","type":"Tape.Tape a -> Basics.Bool"},{"name":"left","comment":" Move at most n positions to the left.\n\nNegative steps move to the right.\n\n    create [\"a\", \"b\", \"c\"] \"d\" [\"e\"]\n        |> left 2\n        |> show identity\n        --> \"[ a, => b, c, d, e ]\"\n\n","type":"Basics.Int -> Tape.Tape a -> Tape.Tape a"},{"name":"leftWith","comment":" Move head to the left according to strategy\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> leftWith (Cycle 3)\n        |> show identity\n        --> \"[ a, b, c, d, => e ]\"\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n         |> leftWith (Default (\"?\", 4))\n         |> show identity\n         --> \"[ => ?, ?, a, b, c, d, e ]\"\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n         |> leftWith (Condition ((/=) \"b\"))\n         |> show identity\n         --> \"[ a, => b, c, d, e ]\"\n\n    create [\"a\", \"b\"] \"cc\" [\"d\", \"e\"]\n        |> leftWith (Carry 2)\n        |> show identity\n        --> \"[ => cc, a, b, d, e ]\"\n\n","type":"Tape.How a -> Tape.Tape a -> Tape.Tape a"},{"name":"length","comment":" Determine the length of a tape.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> length\n        --> 5\n\n","type":"Tape.Tape a -> Basics.Int"},{"name":"map","comment":" Apply a function to every element of a tape.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> map String.toUpper\n        |> show identity\n        --> \"[ A, B, => C, D, E ]\"\n\n","type":"(a -> b) -> Tape.Tape a -> Tape.Tape b"},{"name":"map2","comment":" Combine two tapes with function.\n\nIt keeps the smallest left and right tails of each tape.\n\n    (map2 (++)\n        (create [\"a\", \"b\"] \"c\" [\"d\", \"e\"])\n        (repeat 1 5 \"x\")\n    )\n        |> show identity\n        --> \"[ bx, => cx, dx, ex ]\"\n\n","type":"(a -> b -> result) -> Tape.Tape a -> Tape.Tape b -> Tape.Tape result"},{"name":"map3","comment":" Generalize map for 3 tapes\n","type":"(a -> b -> c -> result) -> Tape.Tape a -> Tape.Tape b -> Tape.Tape c -> Tape.Tape result"},{"name":"map4","comment":" Generalize map for 4 tapes\n","type":"(a -> b -> c -> d -> result) -> Tape.Tape a -> Tape.Tape b -> Tape.Tape c -> Tape.Tape d -> Tape.Tape result"},{"name":"map5","comment":" Generalize map for 5 tapes\n","type":"(a -> b -> c -> d -> e -> result) -> Tape.Tape a -> Tape.Tape b -> Tape.Tape c -> Tape.Tape d -> Tape.Tape e -> Tape.Tape result"},{"name":"maximum","comment":" Find the maximum element in a non-empty list.\n","type":"Tape.Tape comparable -> comparable"},{"name":"member","comment":" Figure out whether a tape contains a value.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> member \"b\"\n        --> True\n\n","type":"a -> Tape.Tape a -> Basics.Bool"},{"name":"minimum","comment":" Find the minimum element in a non-empty list.\n","type":"Tape.Tape comparable -> comparable"},{"name":"parts","comment":" Separate the list in the (left, head, tail) parts.\n\nThe parts can be assembled back together with `create left head tail`\n\n","type":"Tape.Tape a -> ( List.List a, a, List.List a )"},{"name":"position","comment":" Determine the position of head.\n\nPosition corresponds to the number of steps we must move\nright from a rewinded tape.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> position\n        --> 2\n\n","type":"Tape.Tape a -> Basics.Int"},{"name":"positionalMap","comment":" Similar to indexedMap, but uses the position of each element, which is\nequivalent to the index of a rewinded tape.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> positionalMap (\\i x -> String.fromInt i ++ x)\n        |> show identity\n        --> \"[ 0a, 1b, => 2c, 3d, 4e ]\"\n\n","type":"(Basics.Int -> a -> b) -> Tape.Tape a -> Tape.Tape b"},{"name":"product","comment":" Get the product of the list elements.\n","type":"Tape.Tape number -> number"},{"name":"pushLeft","comment":" Push element to the left of the current head and move the cursor to it.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> pushLeft \"changed\"\n        |> show identity\n        --> \"[ a, b, => changed, c, d, e ]\"\n\n","type":"a -> Tape.Tape a -> Tape.Tape a"},{"name":"pushRight","comment":" Push element to the right of the current head and move the cursor to it.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> pushRight \"changed\"\n        |> show identity\n        --> \"[ a, b, c, => changed, d, e ]\"\n\n","type":"a -> Tape.Tape a -> Tape.Tape a"},{"name":"range","comment":" Create a tape of numbers, every element increasing by one.\n\nThe arguments are the lowest and highest numbers that should be on the tape.\n\n    range 0 5\n        |> toList\n        --> [ 0, 1, 2, 3, 4, 5 ]\n\n","type":"Basics.Int -> Basics.Int -> Tape.Tape Basics.Int"},{"name":"read","comment":" Read element on the current position.\n\n    create [1, 2] 3 [4, 5]\n        |> read\n        --> 3\n\n","type":"Tape.Tape a -> a"},{"name":"redo","comment":" An alias to `right 1` that is more idiomatic when using the tape as a history container.\n\n    create [\"a\", \"b\", \"c\"] \"d\" [\"e\"]\n        |> redo\n        |> show identity\n            --> \"[ a, b, c, d, => e ]\"\n\n","type":"Tape.Tape a -> Tape.Tape a"},{"name":"reduce","comment":" Reduce tape applying binary operator.\n\nSimilar to a left fold, but it does not require an initial accumulator.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> reduce (++)\n        --> \"abcde\"\n\n    create [] \"c\" [\"d\", \"e\"]\n        |> reduce (++)\n        --> \"cde\"\n\n","type":"(a -> a -> a) -> Tape.Tape a -> a"},{"name":"repeat","comment":" Create a tape with n copies of a value and tries to place m of them\nbefore the head.\n\n`repeat 0` behaves similarly to List.repeat, creating a tape with n elements\npointing to the first element.\n\nEmpty negative n are ignored, returning a tape with a single element.\n\n    repeat 2 5 \"a\"\n        |> show identity\n        --> \"[ a, a, => a, a, a ]\"\n\n","type":"Basics.Int -> Basics.Int -> a -> Tape.Tape a"},{"name":"reverse","comment":" Flip a tape around the head.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> reverse\n        |> show identity\n        --> \"[ e, d, => c, b, a ]\"\n\n","type":"Tape.Tape a -> Tape.Tape a"},{"name":"rewind","comment":" Rewind tape so the head points to the first element\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> rewind\n        |> show identity\n        --> \"[ => a, b, c, d, e ]\"\n\n","type":"Tape.Tape a -> Tape.Tape a"},{"name":"right","comment":" Move at most n positions to the right.\n\nNegative values move to the left.\n\n    create [\"a\", \"b\", \"c\"] \"d\" [\"e\"]\n        |> right 2\n        |> show identity\n        --> \"[ a, b, c, d, => e ]\"\n\n","type":"Basics.Int -> Tape.Tape a -> Tape.Tape a"},{"name":"rightWith","comment":" Move head to the right according to strategy\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> rightWith (Cycle 3)\n        |> show identity\n        --> \"[ => a, b, c, d, e ]\"\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n            |> rightWith (Default (\"?\", 4))\n            |> show identity\n            --> \"[ a, b, c, d, e, ?, => ? ]\"\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n            |> rightWith (Condition ((/=) \"b\"))\n            |> show identity\n            --> \"[ a, b, c, d, => e ]\"\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> rightWith (Carry 2)\n        |> show identity\n        --> \"[ a, b, d, e, => c ]\"\n\n","type":"Tape.How a -> Tape.Tape a -> Tape.Tape a"},{"name":"select","comment":" Select parts of a tape and return it as a list\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> select All\n        --> [ \"a\", \"b\", \"c\", \"d\", \"e\" ]\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> select Left\n        --> [ \"a\", \"b\", \"c\" ]\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> select Backwards\n        --> [ \"c\", \"b\", \"a\" ]\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> select Head\n        --> [ \"c\" ]\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> select Tails\n        --> [ \"a\", \"b\", \"d\", \"e\" ]\n\n","type":"Tape.Direction -> Tape.Tape a -> List.List a"},{"name":"show","comment":" Show tape as string, with emphasis on head element\n","type":"(a -> String.String) -> Tape.Tape a -> String.String"},{"name":"singleton","comment":" Create a tape with only one element\n","type":"a -> Tape.Tape a"},{"name":"sort","comment":" Sort values from lowest to highest\n\nHead moves to keep track of current element.\n\n    create [\"d\"] \"c\" [\"a\", \"e\", \"b\"]\n        |> sort\n        |> show identity\n        --> \"[ a, b, => c, d, e ]\"\n\n","type":"Tape.Tape comparable -> Tape.Tape comparable"},{"name":"sortBy","comment":" Sort values by a derived property.\n\nHead moves to keep track of current element.\n\n    create [\"d\"] \"cc\" [\"a\", \"eee\", \"bb\"]\n        |> sortBy String.length\n        |> show identity\n        --> \"[ d, a, => cc, bb, eee ]\"\n\n","type":"(a -> comparable) -> Tape.Tape a -> Tape.Tape a"},{"name":"sortWith","comment":" Sort values with a custom comparison function.\n\nHead moves to keep track of current element.\n\n","type":"(a -> a -> Basics.Order) -> Tape.Tape a -> Tape.Tape a"},{"name":"sum","comment":" Get the sum of the list elements.\n","type":"Tape.Tape number -> number"},{"name":"take","comment":" Take elements from one specific direction on the tape\n","type":"Tape.Direction -> Basics.Int -> Tape.Tape a -> Tape.Tape a"},{"name":"toList","comment":" Converts tape to list\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> toList\n        --> [\"a\", \"b\", \"c\", \"d\", \"e\"]\n\n","type":"Tape.Tape a -> List.List a"},{"name":"tryLeft","comment":" Try to move to the left.\n\nReturn Nothing if the tape would overflow on the leftmost position.\n\n    create [\"a\"] \"b\" [\"c\", \"d\", \"e\"]\n        |> tryLeft 2\n        --> Nothing\n\n","type":"Basics.Int -> Tape.Tape a -> Maybe.Maybe (Tape.Tape a)"},{"name":"tryRight","comment":" Try to move to the right.\n\nReturn Nothing if the tape would overflow on the rightmost position.\n\n    create [\"a\", \"b\"] \"c\" [\"d\"]\n        |> tryRight 2\n        --> Nothing\n\n","type":"Basics.Int -> Tape.Tape a -> Maybe.Maybe (Tape.Tape a)"},{"name":"undo","comment":" An alias to `left 1` that is more idiomatic when using the tape as a history container.\n\n    create [\"a\", \"b\", \"c\"] \"d\" [\"e\"]\n        |> undo\n        |> show identity\n            --> \"[ a, b, => c, d, e ]\"\n\n","type":"Tape.Tape a -> Tape.Tape a"},{"name":"unzip","comment":" Decompose a tape of tuples into a tuple of tapes.\n\n    create [(\"a\", 1), (\"b\", 2)] (\"c\", 3) [(\"d\", 4), (\"e\", 5)]\n        |> unzip\n        |> Tuple.mapBoth (show identity) (show String.fromInt)\n        --> ( \"[ a, b, => c, d, e ]\", \"[ 1, 2, => 3, 4, 5 ]\" )\n\n","type":"Tape.Tape ( a, b ) -> ( Tape.Tape a, Tape.Tape b )"},{"name":"update","comment":" A partial map on the tape, preserving the types of elements.\n\nWe can specify a direction to update from the head\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> update Right String.toUpper\n        |> show identity\n        --> \"[ a, b, => C, D, E ]\"\n\nThe direction can be one of the following:\n\n    - `Left` - only the left part is modified, including the head.\n    - `Right` - only the right part is modified, including the head.\n    - `LeftTail` - only the left part is modified, excluding the head.\n    - `RightTail` - only the right part is modified, excluding the head.\n    - `Backwards` - same as Left.\n    - `BackwardsTail` - same as LeftTail.\n    - `Head` - only the head is modified.\n    - `Tails` - modify everything exept the head.\n    - `InsideOut` - like All.\n    - `All` - all elements are modified.\n\n","type":"Tape.Direction -> (a -> a) -> Tape.Tape a -> Tape.Tape a"},{"name":"write","comment":" Write element to the tape's current position.\n\n    create [\"a\", \"b\"] \"c\" [\"d\", \"e\"]\n        |> write \"changed\"\n        |> show identity\n        --> \"[ a, b, => changed, d, e ]\"\n\n","type":"a -> Tape.Tape a -> Tape.Tape a"}],"binops":[]}]