[{"name":"Array.Linear","comment":" `Array` operations that can be applied in either direction.\n\n\n## scan\n\n@docs at\n\n\n## alter\n\n@docs replaceAt, removeAt, insertAt\n@docs padToLength\n\n\n### glue\n\n@docs squeezeInAt\n\n\n### part\n\n@docs take, drop, toChunksOf\n\n\n## transform\n\n@docs foldFrom\n\n","unions":[],"aliases":[],"values":[{"name":"at","comment":" `Just` the element at an index in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ \"lose\", \"win\", \"lose\" ]\n        |> Array.Linear.at 0 LastToFirst\n    --> Just \"lose\"\n\n\n    Array.fromList [ \"lose\", \"win\", \"lose\" ]\n        |> Array.Linear.at 0 FirstToLast\n    --> Just \"lose\"\n\n`Nothing`, if the index is out of range.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.at -1 FirstToLast\n    --> Nothing\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.at 100 FirstToLast\n    --> Nothing\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> Maybe.Maybe element"},{"name":"drop","comment":" After a certain number of elements from one side.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2, 3, 4, 5, 6 ]\n        |> Array.Linear.drop 2 LastToFirst\n    --> Array.fromList [ 1, 2, 3, 4 ]\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.drop 100 FirstToLast\n    --> Array.empty\n\nNothing is dropped if the index is negative.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.drop -1 FirstToLast\n    --> Array.fromList [ 1, 2, 3 ]\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> Array.Array element"},{"name":"foldFrom","comment":" Reduce an `Array` in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'l', 'i', 'v', 'e' ]\n        |> Array.Linear.foldFrom \"\" FirstToLast String.cons\n    --> \"evil\"\n\n    Array.fromList [ 'l', 'i', 'v', 'e' ]\n        |> Array.Linear.foldFrom \"\" LastToFirst String.cons\n    --> \"live\"\n\n","type":"accumulationValue -> LinearDirection.LinearDirection -> (element -> accumulationValue -> accumulationValue) -> Array.Array element -> accumulationValue"},{"name":"insertAt","comment":" Put an element in an `Array` at a given index in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'a', 'c', 'd' ]\n        |> Array.Linear.insertAt 1 FirstToLast 'b'\n    --> Array.fromList [ 'a', 'b', 'c', 'd' ]\n\n    Array.fromList [ 'a', 'c', 'd' ]\n        |> Array.Linear.insertAt 2 LastToFirst 'b'\n    --> Array.fromList [ 'a', 'b', 'c', 'd' ]\n\nIf the index is out of bounds, **nothing is inserted**.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'a', 'c', 'd' ]\n        |> Array.Linear.insertAt -1 FirstToLast 'b'\n    --> Array.fromList [ 'a', 'c', 'd' ]\n\n    Array.fromList [ 'a', 'c', 'd' ]\n        |> Array.Linear.insertAt 4 FirstToLast 'b'\n    --> Array.fromList [ 'a', 'c', 'd' ]\n\n[`squeezeInAt`](#squeezeInAt) allows inserting a whole `Array` of elements.\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> element -> Array.Array element -> Array.Array element"},{"name":"padToLength","comment":" Resize an `Array` in a direction, always padding with the same given value.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2 ]\n        |> Array.Linear.padToLength 4 LastToFirst 0\n    --> Array.fromList [ 0, 0, 1, 2 ]\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.padToLength 2 LastToFirst 0\n    --> Array.fromList [ 2, 3 ]\n\n    Array.fromList [ 1, 2 ]\n        |> Array.Linear.padToLength 4 FirstToLast 0\n    --> Array.fromList [ 1, 2, 0, 0 ]\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.padToLength 2 FirstToLast 0\n    --> Array.fromList [ 1, 2 ]\n\nThe result is an empty array if the index is negative.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    Array.fromList [ 1, 2 ]\n        |> Array.Linear.padToLength -1 LastToFirst 0\n    --> Array.empty\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> element -> Array.Array element -> Array.Array element"},{"name":"removeAt","comment":" Kick an element out of an `Array` at a given index in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'a', 'a', 'b' ]\n        |> Array.Linear.removeAt 1 FirstToLast\n    --> Array.fromList [ 'a', 'b' ]\n\n    Array.fromList [ 'a', 'b', 'c', 'd' ]\n        |> Array.Linear.removeAt 0 LastToFirst\n    --> Array.fromList [ 'a', 'b', 'c' ]\n\nIf the index is out of bounds, nothing is changed.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.Linear.removeAt -1 FirstToLast\n        (Array.fromList [ 'a', 'a', 'b' ])\n    --> Array.fromList [ 'a', 'a', 'b' ]\n\n    Array.Linear.removeAt 100 FirstToLast\n        (Array.fromList [ 'a', 'a', 'b' ])\n    --> Array.fromList [ 'a', 'a', 'b' ]\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> Array.Array element"},{"name":"replaceAt","comment":" Set the element at an index in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ \"I\", \"am\", \"ok\" ]\n        |> Array.Linear.replaceAt 2 FirstToLast \"confusion\"\n    --> Array.fromList [ \"I\", \"am\", \"confusion\" ]\n\n    Array.fromList [ \"I\", \"am\", \"ok\" ]\n        |> Array.Linear.replaceAt 1 LastToFirst \"feel\"\n    --> Array.fromList [ \"I\", \"feel\", \"ok\" ]\n\nIf the index is out of range, the array is unaltered.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ \"I\", \"am\", \"ok\" ]\n        |> Array.Linear.replaceAt -1 FirstToLast \"is\"\n    --> Array.fromList [ \"I\", \"am\", \"ok\" ]\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> element -> Array.Array element -> Array.Array element"},{"name":"squeezeInAt","comment":" Put elements of a given `Array` between the elements left and right to the given index in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'a', 'd', 'e' ]\n        |> Array.Linear.squeezeInAt 1\n            FirstToLast\n            (Array.fromList [ 'b', 'c' ])\n    --> Array.fromList [ 'a', 'b', 'c', 'd', 'e' ]\n\n    Array.fromList [ 'a', 'd', 'e' ]\n        |> Array.Linear.squeezeInAt 2\n            LastToFirst\n            (Array.fromList [ 'b', 'c' ])\n    --> Array.fromList [ 'a', 'b', 'c', 'd', 'e' ]\n\nIf the index is out of bounds, **nothing is inserted**.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 'a', 'd', 'e' ]\n        |> Array.Linear.squeezeInAt -1\n            FirstToLast\n            (Array.fromList [ 'b', 'c' ])\n    --> Array.fromList [ 'a', 'd', 'e' ]\n\n    Array.fromList [ 'a', 'd', 'e' ]\n        |> Array.Linear.squeezeInAt 4\n            FirstToLast\n            (Array.fromList [ 'b', 'c' ])\n    --> Array.fromList [ 'a', 'd', 'e' ]\n\n[`insertAt`](#insertAt) allows inserting a single element.\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> Array.Array element -> Array.Array element"},{"name":"take","comment":" A certain number of elements from one side.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2, 3, 4, 5, 6 ]\n        |> Array.Linear.take 4 FirstToLast\n        |> Array.Linear.take 2 LastToFirst\n    --> Array.fromList [ 3, 4 ]\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.take 100 FirstToLast\n    --> Array.fromList [ 1, 2, 3 ]\n\n    Array.fromList [ 1, 2, 3 ]\n        |> Array.Linear.take -100 FirstToLast\n    --> Array.empty\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> Array.Array element"},{"name":"toChunksOf","comment":" Split the `Array` into equal-sized chunks. The elements left over on one side are in `less`.\n\n    import LinearDirection exposing (LinearDirection(..))\n    import Array\n\n    Array.fromList [ 1, 2, 3, 4, 5, 6, 7 ]\n        |> Array.Linear.toChunksOf 3 FirstToLast\n    --> { chunks =\n    -->     Array.fromList\n    -->         [ Array.fromList [ 1, 2, 3 ]\n    -->         , Array.fromList [ 4, 5, 6 ]\n    -->         ]\n    --> , remainder = Array.fromList [ 7 ]\n    --> }\n\n    Array.fromList [ 1, 2, 3, 4, 5, 6, 7 ]\n        |> Array.Linear.toChunksOf 3 LastToFirst\n    --> { remainder = Array.fromList [ 1 ]\n    --> , chunks =\n    -->     Array.fromList\n    -->         [ Array.fromList [ 2, 3, 4 ]\n    -->         , Array.fromList [ 5, 6, 7 ]\n    -->         ]\n    --> }\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> Array.Array element -> { chunks : Array.Array (Array.Array element), remainder : Array.Array element }"}],"binops":[]},{"name":"LinearDirection","comment":" `FirstToLast`, `LastToFirst`.\n\n@docs LinearDirection\n\n\n## util\n\n@docs opposite\n\n\n### for indices or amounts\n\n@docs toFirstToLast\n\n","unions":[{"name":"LinearDirection","comment":" Either `FirstToLast` or `LastToFirst`.\n","args":[],"cases":[["FirstToLast",[]],["LastToFirst",[]]]}],"aliases":[],"values":[{"name":"opposite","comment":" The other direction. `LastToFirst` ⇆ `FirstToLast`\n","type":"LinearDirection.LinearDirection -> LinearDirection.LinearDirection"},{"name":"toFirstToLast","comment":" Translate an amount or index to one that is used `FirstToLast`.\n\n    import LinearDirection exposing (toFirstToLast)\n\n    at index direction array =\n        Array.get\n            (index\n                |> toFirstToLast direction\n                    { length = Array.length array }\n            )\n\n","type":"LinearDirection.LinearDirection -> { length : Basics.Int } -> Basics.Int -> Basics.Int"}],"binops":[]},{"name":"List.Linear","comment":" `List` operations that can be applied in either direction.\n\n\n## scan\n\n@docs at\n\n\n## alter\n\n\n### part\n\n@docs take, drop\n@docs toChunksOf\n\n\n## transform\n\n@docs foldFrom\n\n","unions":[],"aliases":[],"values":[{"name":"at","comment":" Returns `Just` the element at the given index in the list in a direction:\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    [ 0, 1, 2, 3 ]\n        |> List.Linear.at 0 LastToFirst\n    --> Just 3\n\n    [ 0, 1, 2, 3 ]\n        |> List.Linear.at 2 FirstToLast\n    --> Just 2\n\nReturns `Nothing` if the index is out of range:\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    [ 0, 1, 2, 3 ]\n        |> List.Linear.at 4 FirstToLast\n    --> Nothing\n\n    [ 0, 1, 2, 3 ]\n        |> List.Linear.at -1 FirstToLast\n    --> Nothing\n\nIf you're using this operation often, consider using an `Array` instead of a `List`\nto get `O(log n)` vs. `O(n)` random access performance.\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> List.List element -> Maybe.Maybe element"},{"name":"drop","comment":" Remove a number of elements from one side.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    tail =\n        List.Linear.drop FirstToLast 1\n\n    removeLast =\n        List.Linear.drop LastToFirst 1\n\n","type":"LinearDirection.LinearDirection -> Basics.Int -> List.List element -> List.List element"},{"name":"foldFrom","comment":" Reduce a `List` in a direction.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    [ 'l', 'i', 'v', 'e' ]\n        |> List.Linear.foldFrom \"\" FirstToLast String.cons\n    --> \"evil\"\n\n    [ 'l', 'i', 'v', 'e' ]\n        |> List.Linear.foldFrom \"\" LastToFirst String.cons\n    --> \"live\"\n\n","type":"accumulationValue -> LinearDirection.LinearDirection -> (element -> accumulationValue -> accumulationValue) -> List.List element -> accumulationValue"},{"name":"take","comment":" Only use a number of elements from one side.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    [ 1, 2, 3, 4 ]\n        |> List.Linear.take 2 FirstToLast\n    --> [ 1, 2 ]\n\n    [ 1, 2, 3, 4 ]\n        |> List.Linear.take 2 LastToFirst\n    --> [ 3, 4 ]\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> List.List element -> List.List element"},{"name":"toChunksOf","comment":" Split the `Array` into equal-sized chunks. The elements left over on one side are in `less`.\n\n    import LinearDirection exposing (LinearDirection(..))\n\n    [ 1, 2, 3, 4, 5, 6, 7 ]\n        |> List.Linear.toChunksOf 3 FirstToLast\n    --> { chunks = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]\n    --> , remainder = [ 7 ]\n    --> }\n\n    [ 1, 2, 3, 4, 5, 6, 7 ]\n        |> List.Linear.toChunksOf 3 LastToFirst\n    --> { remainder = [ 1 ]\n    --> , chunks = [ [ 2, 3, 4 ], [ 5, 6, 7 ] ]\n    --> }\n\n","type":"Basics.Int -> LinearDirection.LinearDirection -> List.List element -> { chunks : List.List (List.List element), remainder : List.List element }"}],"binops":[]}]