summary refs log tree commit diff
path: root/lib/lists.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-29 17:25:33 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-08-29 17:50:06 +0200
commit822e1ddd8920e3bd3e631a5bb1892fea60debd4b (patch)
tree64ed0ef3f47374c24914fa650e419d7a4d421281 /lib/lists.nix
parent67c57a9ce53f1f488ab0fc355a4452feeb9c5a67 (diff)
downloadnixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar.gz
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar.bz2
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar.lz
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar.xz
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.tar.zst
nixpkgs-822e1ddd8920e3bd3e631a5bb1892fea60debd4b.zip
Use builtins.partition if available
Diffstat (limited to 'lib/lists.nix')
-rw-r--r--lib/lists.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lists.nix b/lib/lists.nix
index 4bf732b88c9..5e224921de8 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -218,12 +218,12 @@ rec {
        partition (x: x > 2) [ 5 1 2 3 4 ]
        => { right = [ 5 3 4 ]; wrong = [ 1 2 ]; }
   */
-  partition = pred:
+  partition = builtins.partition or (pred:
     fold (h: t:
       if pred h
       then { right = [h] ++ t.right; wrong = t.wrong; }
       else { right = t.right; wrong = [h] ++ t.wrong; }
-    ) { right = []; wrong = []; };
+    ) { right = []; wrong = []; });
 
   /* Merges two lists of the same size together. If the sizes aren't the same
      the merging stops at the shortest. How both lists are merged is defined