Int -> [a] -> a +containers

replicate :: Int -> a -> Seq a
containers Data.Sequence
O(log n). replicate n x is a sequence consisting of n copies of x.
findWithDefault :: a -> Key -> IntMap a -> a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(min(n,W)). The expression (findWithDefault def k map) returns the value at key k or returns def when the key is not an element of the map. > findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x' > findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
singleton :: Key -> a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(1). A map of one element. > singleton 1 'a' == fromList [(1, 'a')] > size (singleton 1 'a') == 1
delete :: Key -> IntSet -> IntSet
containers Data.IntSet
O(min(n,W)). Delete a value in the set. Returns the original set when the value was not present.
insert :: Key -> IntSet -> IntSet
containers Data.IntSet
O(min(n,W)). Add a value to the set. There is no left- or right bias for IntSets.
iterateN :: Int -> (a -> a) -> a -> Seq a
containers Data.Sequence
O(n). Constructs a sequence by repeated application of a function to a seed value. > iterateN n f x = fromList (Prelude.take n (Prelude.iterate f x))
update :: Int -> a -> Seq a -> Seq a
containers Data.Sequence
O(log(min(i,n-i))). Replace the element at the specified position. If the position is out of range, the original sequence is returned.
insert :: Key -> a -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(min(n,W)). Insert a new key/value pair in the map. If the key is already present in the map, the associated value is replaced with the supplied value, i.e. insert is equivalent to insertWith const. > insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')] > insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')] > insert 5 'x' empty == singleton 5 'x'
insertWith :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(min(n,W)). Insert with a combining function. insertWith f key value mp will insert the pair (key, value) into mp if key does not exist in the map. If the key does exist, the function will insert f new_value old_value. > insertWith (++) 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "xxxa")] > insertWith (++) 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")] > insertWith (++) 5 "xxx" empty == singleton 5 "xxx"
insertWith' :: (a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
containers Data.IntMap
Deprecated. As of version 0.5, replaced by insertWith. O(log n). Same as insertWith, but the result of the combining function is evaluated to WHNF before inserted to the map.
insertWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
containers Data.IntMap.Lazy
O(min(n,W)). Insert with a combining function. insertWithKey f key value mp will insert the pair (key, value) into mp if key does not exist in the map. If the key does exist, the function will insert f key new_value old_value. > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value > insertWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:xxx|a")] > insertWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")] > insertWithKey f 5 "xxx" empty == singleton 5 "xxx"
insertWithKey :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
containers Data.IntMap.Strict
O(min(n,W)). Insert with a combining function. insertWithKey f key value mp will insert the pair (key, value) into mp if key does not exist in the map. If the key does exist, the function will insert f key new_value old_value. > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value > insertWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:xxx|a")] > insertWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")] > insertWithKey f 5 "xxx" empty == singleton 5 "xxx" If the key exists in the map, this function is lazy in x but strict in the result of f.
insertWithKey' :: (Key -> a -> a -> a) -> Key -> a -> IntMap a -> IntMap a
containers Data.IntMap
Deprecated. As of version 0.5, replaced by insertWithKey. O(log n). Same as insertWithKey, but the result of the combining function is evaluated to WHNF before inserted to the map.
findWithDefault :: Ord k => a -> k -> Map k a -> a
containers Data.Map.Lazy, containers Data.Map.Strict
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map. > findWithDefault 'x' 1 (fromList [(5,'a'), (3,'b')]) == 'x' > findWithDefault 'x' 5 (fromList [(5,'a'), (3,'b')]) == 'a'
fold :: (a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap
Deprecated. As of version 0.5, replaced by foldr. O(n). Fold the values in the map using the given right-associative binary operator. This function is an equivalent of foldr and is present for compatibility only.
foldr :: (a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Fold the values in the map using the given right-associative binary operator, such that foldr f z == foldr f z . elems. For example, > elems map = foldr (:) [] map > let f a len = len + (length a) > foldr f 0 (fromList [(5,"a"), (3,"bbb")]) == 4
foldr' :: (a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). A strict version of foldr. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b
containers Data.Sequence
foldlWithIndex is a version of foldl that also provides access to the index of each element.
foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b
containers Data.Sequence
foldrWithIndex is a version of foldr that also provides access to the index of each element.
(:>) :: Seq a -> a -> ViewR a
containers Data.Sequence
the sequence minus the rightmost element, and the rightmost element
(|>) :: Seq a -> a -> Seq a
containers Data.Sequence
O(1). Add an element to the right end of a sequence. Mnemonic: a triangle with the single element at the pointy end.
fold :: (a -> b -> b) -> b -> Set a -> b
containers Data.Set
O(n). Fold the elements in the set using the given right-associative binary operator. This function is an equivalent of foldr and is present for compatibility only. Please note that fold will be deprecated in the future and removed.
foldr :: (a -> b -> b) -> b -> Set a -> b
containers Data.Set
O(n). Fold the elements in the set using the given right-associative binary operator, such that foldr f z == foldr f z . toAscList. For example, > toAscList set = foldr (:) [] set
foldr' :: (a -> b -> b) -> b -> Set a -> b
containers Data.Set
O(n). A strict version of foldr. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
foldl :: (a -> b -> a) -> a -> IntMap b -> a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Fold the values in the map using the given left-associative binary operator, such that foldl f z == foldl f z . elems. For example, > elems = reverse . foldl (flip (:)) [] > let f len a = len + (length a) > foldl f 0 (fromList [(5,"a"), (3,"bbb")]) == 4
foldl' :: (a -> b -> a) -> a -> IntMap b -> a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). A strict version of foldl. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
foldl :: (a -> b -> a) -> a -> Set b -> a
containers Data.Set
O(n). Fold the elements in the set using the given left-associative binary operator, such that foldl f z == foldl f z . toAscList. For example, > toDescList set = foldl (flip (:)) [] set
foldl' :: (a -> b -> a) -> a -> Set b -> a
containers Data.Set
O(n). A strict version of foldl. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Fold the keys and values in the map using the given right-associative binary operator, such that foldrWithKey f z == foldr (uncurry f) z . toAscList. For example, > keys map = foldrWithKey (\k x ks -> k:ks) [] map > let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")" > foldrWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)"
foldrWithKey' :: (Key -> a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). A strict version of foldrWithKey. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
foldWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
containers Data.IntMap
Deprecated. As of version 0.5, replaced by foldrWithKey. O(n). Fold the keys and values in the map using the given right-associative binary operator. This function is an equivalent of foldrWithKey and is present for compatibility only.
(:<) :: a -> Seq a -> ViewL a
containers Data.Sequence
leftmost element and the rest of the sequence
(<|) :: a -> Seq a -> Seq a
containers Data.Sequence
O(1). Add an element to the left end of a sequence. Mnemonic: a triangle with the single element at the pointy end.
foldlWithKey :: (a -> Key -> b -> a) -> a -> IntMap b -> a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Fold the keys and values in the map using the given left-associative binary operator, such that foldlWithKey f z == foldl (\z' (kx, x) -> f z' kx x) z . toAscList. For example, > keys = reverse . foldlWithKey (\ks k x -> k:ks) [] > let f result k a = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")" > foldlWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (3:b)(5:a)"
foldlWithKey' :: (a -> Key -> b -> a) -> a -> IntMap b -> a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). A strict version of foldlWithKey. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
index :: Seq a -> Int -> a
containers Data.Sequence
O(log(min(i,n-i))). The element at the specified position, counting from 0. The argument should thus be a non-negative integer less than the size of the sequence. If the position is out of range, index fails with an error.
foldl :: (a -> Key -> a) -> a -> IntSet -> a
containers Data.IntSet
O(n). Fold the elements in the set using the given left-associative binary operator, such that foldl f z == foldl f z . toAscList. For example, > toDescList set = foldl (flip (:)) [] set
foldl' :: (a -> Key -> a) -> a -> IntSet -> a
containers Data.IntSet
O(n). A strict version of foldl. Each application of the operator is evaluated before using the result in the next application. This function is strict in the starting value.
fold :: (Key -> b -> b) -> b -> IntSet -> b
containers Data.IntSet
O(n). Fold the elements in the set using the given right-associative binary operator. This function is an equivalent of foldr and is present for compatibility only. Please note that fold will be deprecated in the future and removed.
foldr :: (Key -> b -> b) -> b -> IntSet -> b
containers Data.IntSet
O(n). Fold the elements in the set using the given right-associative binary operator, such that foldr f z == foldr f z . toAscList. For example, > toAscList set = foldr (:) [] set

Show more results