[{"name":"Bag","comment":" Implementation of a Bag using a dictionary and an encoding function to turn any value into a comparable one.\n\n\n# Type\n\n@docs Bag\n\n\n# Constructor\n\n@docs count, empty, singleton\n\n\n# Operations\n\n@docs insert, remove, plus, minus, intersection\n\n\n# Methods\n\n@docs isEmpty, member, size\n\n\n# Conversion\n\n@docs fromList, toList, toAssociationList, fromAssociationList\n\n","unions":[],"aliases":[{"name":"Bag","comment":" type alias of a bag.\n\nUse the encode function to access elements in the dictionary.\n\n","args":["comparable","a"],"type":"{ content : Dict.Dict comparable ( a, Basics.Int ), encode : a -> comparable }"}],"values":[{"name":"count","comment":" Count the amounts of an element in the bag\n\n    empty identity\n        |> count \"🍎\"\n        --> 0\n\n.\n\n    [ ( \"🍎\", 42 ) ]\n        |> fromAssociationList identity\n        |> count \"🍎\"\n        --> 42\n\n.\n\n    [ ( \"🍊\", 42 ) ]\n        |> fromAssociationList identity\n        |> count \"🍎\"\n        --> 0\n\n","type":"a -> Bag.Bag comparable a -> Basics.Int"},{"name":"empty","comment":" Construct an empty bag\n\n    empty identity |> toAssociationList --> []\n\n","type":"(a -> comparable) -> Bag.Bag comparable a"},{"name":"fromAssociationList","comment":" Construct from an association list\n","type":"(a -> comparable) -> List.List ( a, Basics.Int ) -> Bag.Bag comparable a"},{"name":"fromList","comment":" Counts the occurrences of elements in a bag.\n\n    []\n        |> fromList identity\n        |> toAssociationList\n        --> []\n\n.\n\n    [ \"🍎\", \"🍎\" ]\n        |> fromList identity\n        |> toAssociationList\n        --> [(\"🍎\",2)]\n\n.\n\n    [ \"🍇\", \"🍎\", \"🍊\" ]\n        |> fromList identity\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",1)]\n\n.\n\n    [ \"🍇\", \"🍎\", \"🍊\", \"🍎\", \"🍊\", \"🍎\" ]\n        |> fromList identity\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",2),(\"🍎\",3)]\n\n","type":"(a -> comparable) -> List.List a -> Bag.Bag comparable a"},{"name":"insert","comment":" Insert an element into the bag\n\n    empty identity\n        |> insert 1 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍎\",1)]\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍎\", 1 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> insert 2 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",3)]\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> insert 1 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",1)]\n\n","type":"Basics.Int -> a -> Bag.Bag comparable a -> Bag.Bag comparable a"},{"name":"intersection","comment":" Intersect two bags.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> intersection (empty identity)\n        |> toAssociationList\n        --> []\n\n.\n\n    empty identity\n        |> intersection (\n            [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> []\n\n.\n\n    [ ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> intersection (\n            [ ( \"🍇\", 1 ), ( \"🍎\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> [(\"🍎\",1)]\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 2 ), ( \"🍊\", 3 ) ]\n        |> fromAssociationList identity\n        |> intersection (\n            [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 3 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",2)]\n\n","type":"Bag.Bag comparable a -> Bag.Bag comparable a -> Bag.Bag comparable a"},{"name":"isEmpty","comment":" Check if the bag is empty\n\n    empty identity\n        |> isEmpty\n        --> True\n\n    singleton identity \"🍎\"\n        |> isEmpty\n        --> False\n\n","type":"Bag.Bag comparable a -> Basics.Bool"},{"name":"member","comment":" Compute if the element is a member\n\n    member \"🍎\" (empty identity) --> False\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> member \"🍎\"\n        --> True\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> member \"🍒\"\n        --> False\n\n","type":"a -> Bag.Bag comparable a -> Basics.Bool"},{"name":"minus","comment":" subtracts the first bag from the second.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> minus (empty identity)\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",1)]\n\n.\n\n    empty identity\n        |> minus (\n            [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> []\n\n.\n\n    [ ( \"🍇\", 2 ), ( \"🍎\", 2 ), ( \"🍊\", 2 ) ]\n        |> fromAssociationList identity\n        |> minus (\n            [ ( \"🍎\", 2 ), ( \"🍊\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> [(\"🍇\",2),(\"🍊\",1)]\n\n","type":"Bag.Bag comparable a -> Bag.Bag comparable a -> Bag.Bag comparable a"},{"name":"plus","comment":" Combine two bags.\n\n    [ ( \"🍇\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> plus (\n            [ ( \"🍒\", 1 ), ( \"🍎\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",1),(\"🍒\",1)]\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> plus (singleton identity \"🍎\")\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",2)]\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ]\n        |> fromAssociationList identity\n        |> plus (\n            [ ( \"🍎\", 1 ), ( \"🍒\", 1 ) ]\n                |> fromAssociationList identity\n        )\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",2),(\"🍒\",1)]\n\n","type":"Bag.Bag comparable a -> Bag.Bag comparable a -> Bag.Bag comparable a"},{"name":"remove","comment":" Remove an element from the bag\n\n    empty identity\n        |> remove 1 \"🍎\"\n        |> toAssociationList\n        --> []\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> remove 1 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1),(\"🍎\",1)]\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> remove 1 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1)]\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍎\", 1 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> remove 1 \"🍎\"\n        |> toAssociationList\n        --> [(\"🍇\",1),(\"🍊\",1)]\n\n","type":"Basics.Int -> a -> Bag.Bag comparable a -> Bag.Bag comparable a"},{"name":"singleton","comment":" Construct a bag with a single element\n\n    singleton identity \"🍎\" |> toAssociationList --> [ ( \"🍎\", 1 ) ]\n\n","type":"(a -> comparable) -> a -> Bag.Bag comparable a"},{"name":"size","comment":" Counts all elements in the bag\n\n    size (empty identity) --> 0\n\n.\n\n    [ ( \"🍇\", 1 ), ( \"🍎\", 2 ), ( \"🍊\", 3 ) ]\n        |> fromAssociationList identity\n        |> size\n        --> 6\n\n","type":"Bag.Bag comparable a -> Basics.Int"},{"name":"toAssociationList","comment":" Convert into an association list\n","type":"Bag.Bag comparable a -> List.List ( a, Basics.Int )"},{"name":"toList","comment":" Convert into a list with repeating elements\n\n    empty identity\n        |> toList\n         --> []\n\n.\n\n    [ ( \"🍎\", 2 ) ]\n        |> fromAssociationList identity\n        |> toList\n        --> [\"🍎\",\"🍎\"]\n\n.\n\n    [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 1 ) ]\n        |> fromAssociationList identity\n        |> toList\n        --> [\"🍇\",\"🍊\",\"🍎\",\"🍎\"]\n\n","type":"Bag.Bag comparable a -> List.List a"}],"binops":[]},{"name":"List.Bag","comment":" Use an association list as a bag\n\n\n# Constructor\n\n@docs count, empty, singleton\n\n\n# Operations\n\n@docs insert, remove, plus, minus, intersection\n\n\n# Methods\n\n@docs isEmpty, member, size\n\n\n# Conversion\n\n@docs fromList, toList\n\n","unions":[],"aliases":[],"values":[{"name":"count","comment":" Count the amounts of an element in the list\n\n    count \"🍎\" [] --> 0\n\n    count \"🍎\" [ ( \"🍎\", 42 ) ] --> 42\n\n    count \"🍎\" [ ( \"🍊\", 42 ) ] --> 0\n\n","type":"a -> List.List ( a, Basics.Int ) -> Basics.Int"},{"name":"empty","comment":" Construct an empty list\n\n    empty --> []\n\n","type":"List.List ( a, Basics.Int )"},{"name":"fromList","comment":" Counts the occurrences of elements in a list.\n\n    fromList [] --> []\n\n    fromList [ \"🍎\", \"🍎\" ] --> [(\"🍎\",2)]\n\n    fromList [ \"🍇\", \"🍎\", \"🍊\" ] --> [(\"🍇\",1),(\"🍎\",1),(\"🍊\",1)]\n\n    fromList [ \"🍇\", \"🍎\", \"🍊\", \"🍎\", \"🍊\", \"🍎\" ] --> [(\"🍇\",1),(\"🍎\",3),(\"🍊\",2)]\n\n","type":"List.List a -> List.List ( a, Basics.Int )"},{"name":"insert","comment":" Insert an element into the list\n\n    insert 1 \"🍎\" [] --> [(\"🍎\",1)]\n\n    insert 2 \"🍎\" [ ( \"🍊\", 1 ), ( \"🍎\", 1 ), ( \"🍇\", 1 ) ] --> [(\"🍊\",1),(\"🍎\",3),(\"🍇\",1)]\n\n    insert 1 \"🍎\" [ ( \"🍊\", 1 ), ( \"🍇\", 1 ) ] --> [(\"🍎\",1),(\"🍊\",1),(\"🍇\",1)]\n\n","type":"Basics.Int -> a -> List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int )"},{"name":"intersection","comment":" Intersect two lists. The order of the second list gets preserved.\n\n    intersection [] [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> []\n\n    intersection [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] [] --> []\n\n    intersection [ ( \"🍇\", 1 ), ( \"🍎\", 1 ) ] [ ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> [(\"🍎\",1)]\n\n    intersection [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 3 ) ] [ ( \"🍇\", 1 ), ( \"🍎\", 2 ), ( \"🍊\", 3 ) ] --> [(\"🍇\",1),(\"🍎\",2),(\"🍊\",1)]\n\n","type":"List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int )"},{"name":"isEmpty","comment":" Check if the list is empty\n\n    isEmpty [] --> True\n\n    isEmpty [ ( \"🍎\", 42 ) ] --> False\n\n","type":"List.List ( a, Basics.Int ) -> Basics.Bool"},{"name":"member","comment":" Compute if the element is a member\n\n    member \"🍎\" [] --> False\n\n    member \"🍎\" [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> True\n\n    member \"🍒\" [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> False\n\n","type":"a -> List.List ( a, Basics.Int ) -> Basics.Bool"},{"name":"minus","comment":" subtracts the first list from the second.\n\n    minus [] [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> [(\"🍇\",1),(\"🍎\",1),(\"🍊\",1)]\n\n    minus [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] [] --> []\n\n    minus [ ( \"🍎\", 2 ), ( \"🍊\", 1 ) ] [ ( \"🍇\", 2 ), ( \"🍎\", 2 ), ( \"🍊\", 2 ) ] --> [(\"🍇\",2),(\"🍊\",1)]\n\n","type":"List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int )"},{"name":"plus","comment":" Combine two lists. The order of the second list gets preserved.\n\n    plus [ ( \"🍒\", 1 ), ( \"🍎\", 1 ) ] [ ( \"🍇\", 1 ), ( \"🍊\", 1 ) ] --> [(\"🍇\",1),(\"🍊\",1),(\"🍒\",1),(\"🍎\",1)]\n\n    plus [ ( \"🍎\", 1 ) ] [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> [(\"🍇\",1),(\"🍎\",2),(\"🍊\",1)]\n\n    plus [ ( \"🍎\", 1 ), ( \"🍒\", 1 ) ] [ ( \"🍇\", 1 ), ( \"🍎\", 1 ), ( \"🍊\", 1 ) ] --> [(\"🍇\",1),(\"🍎\",2),(\"🍊\",1),(\"🍒\",1)]\n\n","type":"List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int )"},{"name":"remove","comment":" Remove an element from the list\n\n    remove 1 \"🍎\" [] --> []\n\n    remove 1 \"🍎\" [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 1 ) ] --> [(\"🍊\",1),(\"🍎\",1),(\"🍇\",1)]\n\n    remove 1 \"🍎\" [ ( \"🍊\", 1 ), ( \"🍇\", 1 ) ] --> [(\"🍊\",1),(\"🍇\",1)]\n\n    remove 1 \"🍎\" [ ( \"🍊\", 1 ), ( \"🍎\", 1 ), ( \"🍇\", 1 ) ] --> [(\"🍊\",1),(\"🍇\",1)]\n\n","type":"Basics.Int -> a -> List.List ( a, Basics.Int ) -> List.List ( a, Basics.Int )"},{"name":"singleton","comment":" Construct a list with a single element\n\n    singleton \"🍎\" --> [ ( \"🍎\", 1 ) ]\n\n","type":"a -> List.List ( a, Basics.Int )"},{"name":"size","comment":" Counts all elements in the list\n\n    size [] --> 0\n\n    size [ ( \"🍇\", 1 ), ( \"🍎\", 2 ), ( \"🍊\", 3 ) ] --> 6\n\n","type":"List.List ( a, Basics.Int ) -> Basics.Int"},{"name":"toList","comment":" Convert into a list with repeating elements\n\n    toList [] --> []\n\n    toList [ ( \"🍎\", 2 ) ] --> [\"🍎\",\"🍎\"]\n\n    toList [ ( \"🍊\", 1 ), ( \"🍎\", 2 ), ( \"🍇\", 1 ) ] --> [\"🍊\",\"🍎\",\"🍎\",\"🍇\"]\n\n","type":"List.List ( a, Basics.Int ) -> List.List a"}],"binops":[]}]