added Haskell's foldl
svn path=/nixpkgs/trunk/; revision=13553
This commit is contained in:
parent
0b49861c7b
commit
9e7846d214
|
@ -96,6 +96,12 @@ rec {
|
|||
then nul
|
||||
else op (head list) (fold op nul (tail list));
|
||||
|
||||
# Haskell's fold
|
||||
foldl = op: nul: list:
|
||||
if list == []
|
||||
then nul
|
||||
else fold op (op nul (head list)) (tail list);
|
||||
|
||||
|
||||
# Concatenate a list of lists.
|
||||
concatList = x : y : x ++ y;
|
||||
|
|
Loading…
Reference in New Issue