added Haskell's foldl

svn path=/nixpkgs/trunk/; revision=13553
This commit is contained in:
Marc Weber 2008-12-02 12:28:21 +00:00
parent 0b49861c7b
commit 9e7846d214

View File

@ -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;