Use builtins.sort

Changed files
+3 -2
lib
+3 -2
lib/lists.nix
···
# elements and returns true if the first argument is strictly below
# the second argument. The returned list is sorted in an increasing
# order. The implementation does a quick-sort.
-
sort = strictLess: list:
let
len = length list;
first = head list;
···
pivot = pivot' 1 { left = []; right = []; };
in
if len < 2 then list
-
else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right);
# Return the first (at most) N elements of a list.
···
# elements and returns true if the first argument is strictly below
# the second argument. The returned list is sorted in an increasing
# order. The implementation does a quick-sort.
+
sort = builtins.sort or (
+
strictLess: list:
let
len = length list;
first = head list;
···
pivot = pivot' 1 { left = []; right = []; };
in
if len < 2 then list
+
else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right));
# Return the first (at most) N elements of a list.