git.iko.soy/typeable/nixpkgs
on master help sign in
Use builtins.partition if available
commit822e1ddd8920e3bd3e631a5bb1892fea60debd4b authorEelco Dolstra <eelco.dolstra@logicblox.com> dateMon 29 Aug 2016, 17:25 (10 years ago) parent67c57a9
1 file changed+2−2
lib/lists.nix+2−2
lib/lists.nix+2−2
@@ -218,12 +218,12 @@ rec {
218218 partition (x: x > 2) [ 5 1 2 3 4 ]
219219 => { right = [ 5 3 4 ]; wrong = [ 1 2 ]; }
220220 */
221− partition = pred:
221+ partition = builtins.partition or (pred:
222222 fold (h: t:
223223 if pred h
224224 then { right = [h] ++ t.right; wrong = t.wrong; }
225225 else { right = t.right; wrong = [h] ++ t.wrong; }
226− ) { right = []; wrong = []; };
226+ ) { right = []; wrong = []; });
227227
228228 /* Merges two lists of the same size together. If the sizes aren't the same
229229 the merging stops at the shortest. How both lists are merged is defined