[{"name":"RandomTree.Uniform","comment":" This module provides data structure subjected to random choice of elements in uniform probability.\n\n\n## Note\n\n`Tree` in this module\n\n  - is not allowed to be empty, so\n      - the return value of function that reduce the number of element(`take`, `delete`, and `filter`) all return `Maybe (Tree a)` just in case all the elements are deleted.\n      - You have to pass at least one element at the creation, so function like `fromList` takes one heading element and tailing list.(similar with `Random.uniform` or `Random.weighted`.)\n  - is not a search tree(the elements are not ordered), so the time complexity of `member` and `delete` is _O(N)_.\n  - may be unbalanced when `delete` or `filter` is called, so when I say \"The time complexity is _O(log(N))_\", _N_ denotes the maximal size in the history of the tree so far.\n\n\n# Types\n\n@docs Tree\n\n\n# Creation\n\n@docs singleton, fromList\n\n\n# Insertion\n\n@docs insert, insertList\n\n\n# Modification\n\n@docs map, filter, delete\n\n\n# Random Picking Up\n\n@docs get, take, replace\n\n\n# Status Checking\n\n@docs count\n\n","unions":[{"name":"Tree","comment":" Type that represents binary tree with elements subjected to random picking up in uniform probabilities.\n","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"count","comment":" Returns how many elements the tree has.\n","type":"RandomTree.Uniform.Tree a -> Basics.Int"},{"name":"delete","comment":" Removes any number of elements which is the same as the first parameter from the second parameter.\n","type":"a -> RandomTree.Uniform.Tree a -> Maybe.Maybe (RandomTree.Uniform.Tree a)"},{"name":"filter","comment":" Removes any number of elements which fails to passes the test function given as the first parameter.\n","type":"(a -> Basics.Bool) -> RandomTree.Uniform.Tree a -> Maybe.Maybe (RandomTree.Uniform.Tree a)"},{"name":"fromList","comment":" Returns a `Tree` that has all elements in given list.\n","type":"a -> List.List a -> RandomTree.Uniform.Tree a"},{"name":"get","comment":" Random generator that generates one of the elements conteined in `Tree` given as parameter.\nThe time complexity is _O(log(N))_.\n","type":"RandomTree.Uniform.Tree a -> Random.Generator a"},{"name":"insert","comment":" Inserts a data to an already-existing `Tree`.\n","type":"a -> RandomTree.Uniform.Tree a -> RandomTree.Uniform.Tree a"},{"name":"insertList","comment":" Inserts all elements of given list into the tree.\n","type":"List.List a -> RandomTree.Uniform.Tree a -> RandomTree.Uniform.Tree a"},{"name":"map","comment":" Maps all the content of the tree.\n","type":"(a -> b) -> RandomTree.Uniform.Tree a -> RandomTree.Uniform.Tree b"},{"name":"replace","comment":" Random generator that replaces one data from the tree and generates a pair consisting of the removed data and resultant tree.\n","type":"a -> RandomTree.Uniform.Tree a -> Random.Generator ( a, RandomTree.Uniform.Tree a )"},{"name":"singleton","comment":" Returns a `Tree` that has only one element.\n","type":"a -> RandomTree.Uniform.Tree a"},{"name":"take","comment":" Random generator that generates one of the elements conteined in `Tree`, paired with the rest part of the tree. The time complexity is _O(log(N))_.\n","type":"RandomTree.Uniform.Tree a -> Random.Generator ( a, Maybe.Maybe (RandomTree.Uniform.Tree a) )"}],"binops":[]},{"name":"RandomTree.Weighted","comment":" This module provides data structure that allows random picking up from a collection of data in _O(log(N))_ time. You can set weight of each element with `WideFloat` from `kudzu-forest/elm-wide-float` package.\n\n\n## Note\n\n`Tree` in this module\n\n  - is not allowed to be empty, so\n      - the return value of function that reduce the number of element(`take`, `delete`, and `filter`) all return `Maybe (Tree a)` just in case all the elements are deleted.\n      - You have to pass at least one element at the creation, so function like `fromList` takes one heading element and tailing list.(similar with `Random.uniform` or `Random.weighted`.)\n  - can not have zero-or-negative-weighted elements. So if you give ones, the weight is automatically converted to `1`. This may be an error prone, but otherwise all things must be wrapped in `Maybe`.\n  - is not a search tree(the elements are not ordered), so the time complexity of `member` and `delete` is _O(N)_.\n  - may be unbalanced when `delete` or `filter` is called, so when I say \"The time complexity is _O(log(N))_\", _N_ denotes the maximal size in the history of the tree so far.\n\n\n# Types\n\n@docs Tree, Weighted, WideFloat\n\n\n# Operation around weighted datum\n\n@docs adjustWeight, adjustContent\n\n\n# Creation\n\n@docs singleton, fromList, fromPairs\n\n\n# Insertion\n\n@docs insert, insertWithRelativeWeight, insertListWithRelativeWeight\n\n\n# Modification\n\n@docs delete, map, filter\n\n\n# Random Pick Up\n\n@docs get, take, replace\n\n\n# Status Checking\n\n@docs count, totalWeight\n\n","unions":[{"name":"Tree","comment":" Type that represents binary tree with weighted elements subjected to random picking up.\n","args":["a"],"cases":[]}],"aliases":[{"name":"Weighted","comment":" Type alias that represents each weighted contents in `Tree`. The probability of being chosen is proportional to its weight.\nThe weight is represented with `WideFloat.WideFloat` type in `kudzu-forest/elm-wide-float` package.\n","args":["a"],"type":"{ weight : WideFloat.WideFloat, content : a }"},{"name":"WideFloat","comment":" Type that represent floating point number with wider range than `Float` in core package. This is introduced for preventing overflow of exponentially changing value.\nPlease hit `elm install kudzu-forest/elm-wide-float` in your terminal.\n","args":[],"type":"WideFloat.WideFloat"}],"values":[{"name":"adjustContent","comment":" Maps content in `Element`.\n","type":"(a -> b) -> RandomTree.Weighted.Weighted a -> RandomTree.Weighted.Weighted b"},{"name":"adjustWeight","comment":" Returns weighted datum whose weight is multiplied with the given `Float`.\n","type":"Basics.Float -> RandomTree.Weighted.Weighted a -> RandomTree.Weighted.Weighted a"},{"name":"count","comment":" Returns how many elements the tree has. The time complexity is _O(1)_\n","type":"RandomTree.Weighted.Tree a -> Basics.Int"},{"name":"delete","comment":" Removes any number of elements which is the same as the first parameter from the second parameter. The returned value is wrapped in `Maybe`. The time complexity is _O(N)_.\n","type":"a -> RandomTree.Weighted.Tree a -> Maybe.Maybe (RandomTree.Weighted.Tree a)"},{"name":"filter","comment":" Removes any number of elements which passes the test function given as the first parameter from the second parameter. The returned value is wrapped in `Maybe`.\n","type":"(RandomTree.Weighted.WideFloat -> a -> Basics.Bool) -> RandomTree.Weighted.Tree a -> Maybe.Maybe (RandomTree.Weighted.Tree a)"},{"name":"fromList","comment":" Returns a `Tree` that has all element in given list.Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)\n","type":"RandomTree.Weighted.Weighted a -> List.List (RandomTree.Weighted.Weighted a) -> RandomTree.Weighted.Tree a"},{"name":"fromPairs","comment":" Creates `Tree` from list of tuples of a `Float` value corresponding to its weight as the first component, and a datum as the second component. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)\n","type":"( Basics.Float, a ) -> List.List ( Basics.Float, a ) -> RandomTree.Weighted.Tree a"},{"name":"get","comment":" Random generator that generates one of the elements conteined in `Tree` given as parameter. The probability for each elements to be chosen is proportional to its weight. The time complexity is _O(log(N))_.\n","type":"RandomTree.Weighted.Tree a -> Random.Generator a"},{"name":"insert","comment":" Inserts a Weighted data to an already-existing `Tree`. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)\n","type":"RandomTree.Weighted.Weighted a -> RandomTree.Weighted.Tree a -> RandomTree.Weighted.Tree a"},{"name":"insertListWithRelativeWeight","comment":" Inserts all elements of given list into the tree of second parameter. The first components of the tuple denotes the relative weight(`1` means the whole weight of the original tree).\n","type":"List.List ( Basics.Float, a ) -> RandomTree.Weighted.Tree a -> RandomTree.Weighted.Tree a"},{"name":"insertWithRelativeWeight","comment":" Inserts an element into the tree. The first parameter denotes the relative weight(`1` means the whole weight of the original tree). The time complexity is _O(log(N))_.\n","type":"Basics.Float -> a -> RandomTree.Weighted.Tree a -> RandomTree.Weighted.Tree a"},{"name":"map","comment":" Maps all the content of the tree, with the weights unchanged.\n","type":"(a -> b) -> RandomTree.Weighted.Tree a -> RandomTree.Weighted.Tree b"},{"name":"replace","comment":" Random generator that replaces one weighted data from the tree and generates a pair consisting of the removed data and resultant tree. The time complexity is _O(log(N))_\n","type":"RandomTree.Weighted.Weighted a -> RandomTree.Weighted.Tree a -> Random.Generator ( RandomTree.Weighted.Weighted a, RandomTree.Weighted.Tree a )"},{"name":"singleton","comment":" Returns a `Tree` that has only one element. Never give this function a negetive-or-zero-weighted element.(If the weight is negative or zero, the weight is automatically converted to 1.)\n","type":"RandomTree.Weighted.Weighted a -> RandomTree.Weighted.Tree a"},{"name":"take","comment":" Random generator that generates one of the elements conteined in `Tree`, paired with the rest part of the tree.\nIf the `Tree` has only one element, then `Nothing` is returned as the second component.\nThe time complexity is _O(log(N))_.\n","type":"RandomTree.Weighted.Tree a -> Random.Generator ( RandomTree.Weighted.Weighted a, Maybe.Maybe (RandomTree.Weighted.Tree a) )"},{"name":"totalWeight","comment":" Returns the sum of weight of all the elements in the tree. The time complexity is _O(1)_\n","type":"RandomTree.Weighted.Tree a -> RandomTree.Weighted.WideFloat"}],"binops":[]}]