diff options
Diffstat (limited to 'pkgs/lib')
-rw-r--r-- | pkgs/lib/lists.nix | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 9b8334a5b9dfc..e279d6a80f47b 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -177,4 +177,10 @@ rec { let loop = l: if tail l == [] then head l else loop (tail l); in loop list; + # Zip two lists together. + zip = xs: ys: + if xs != [] && ys != [] then + [ {first = head xs; second = head ys;} ] + ++ zip (tail xs) (tail ys) + else []; } |