summary refs log tree commit diff
path: root/pkgs/lib
diff options
context:
space:
mode:
authorSander van der Burg <s.vanderburg@tudelft.nl>2010-08-02 16:10:01 +0000
committerSander van der Burg <s.vanderburg@tudelft.nl>2010-08-02 16:10:01 +0000
commitbeee6e5e1d1ab456a162de827440cd4890514a2b (patch)
treea23eca80901a10f818b01ed631faaa2f09b148d1 /pkgs/lib
parentcc84ac9e84c2e1be9eabd0033437486efb42277c (diff)
Moved 'zip' function from nixos/lib/build-vms.nix
svn path=/nixpkgs/trunk/; revision=22882
Diffstat (limited to 'pkgs/lib')
-rw-r--r--pkgs/lib/lists.nix6
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 [];
 }