**foldl** -base -bytestring

*O(n)* foldl, applied to a binary operator, a starting value (typically the left-identity of the operator), and a Text, reduces the Text using the binary operator, from left to right. Subject to fusion.
*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
*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
*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
*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
This library provides strict left folds that stream in constant memory, and you can combine folds using Applicative style to derive new folds. Derived folds still traverse the container just once and are often as efficient as hand-written folds.
Version 1.0.0

*O(n)* A strict version of foldl. Subject to fusion.
*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.
*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.
*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.
*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.
*O(n)* A variant of foldl that has no starting value argument, and thus must be applied to a non-empty Text. Subject to fusion.
*O(n)* A strict version of foldl1. Subject to fusion.
Consume the chunks of a lazy Text with a strict, tail-recursive, accumulating left fold.
*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)"
*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)"
*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.
*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.
gfoldl with accumulation

Show more results