foldl -base +containers

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 -> 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 -> Map k b -> a
containers Data.Map.Lazy, containers Data.Map.Strict
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 -> 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 -> 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.
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 -> Map k b -> a
containers Data.Map.Lazy, containers Data.Map.Strict
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). 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.
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.
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 -> k -> b -> a) -> a -> Map k b -> a
containers Data.Map.Lazy, containers Data.Map.Strict
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.
foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a
containers Data.Map.Lazy, containers Data.Map.Strict
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.
unfoldl :: (b -> Maybe (b, a)) -> b -> Seq a
containers Data.Sequence
unfoldl f x is equivalent to reverse (unfoldr (fmap swap . f) x).