3
0
Fork 0
forked from mirrors/nixpkgs

Add the zipLists and zipListsWith functions.

svn path=/nixpkgs/trunk/; revision=17476
This commit is contained in:
Nicolas Pierron 2009-09-28 18:22:14 +00:00
parent af88789507
commit e6399964cb

View file

@ -127,5 +127,13 @@ rec {
else { right = t.right; wrong = [h] ++ t.wrong; }
) { right = []; wrong = []; };
zipListsWith = f: fst: snd:
if fst != [] && snd != [] then
[ (f (head fst) (head snd)) ]
++ zipLists (tail fst) (tail snd)
else [];
zipLists = zipListsWith (fst: snd: { inherit fst snd; });
}