diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-28 18:42:04 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-28 18:42:22 +0200 |
commit | 395fdaef6c9efb7141ddd87ac1be02e6650e3a10 (patch) | |
tree | da7b1339e9c4f70daeeacfdd3d5e45aa30bec766 /lib/lists.nix | |
parent | 5976d393fb92b0151fb1b56f6bc76490bc7ea4bf (diff) | |
download | nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar.gz nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar.bz2 nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar.lz nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar.xz nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.tar.zst nixpkgs-395fdaef6c9efb7141ddd87ac1be02e6650e3a10.zip |
Use builtins.sort
Diffstat (limited to 'lib/lists.nix')
-rw-r--r-- | lib/lists.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lists.nix b/lib/lists.nix index 76e03ce46db..3bcf366f0c2 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -176,7 +176,8 @@ rec { # 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: + sort = builtins.sort or ( + strictLess: list: let len = length list; first = head list; @@ -190,7 +191,7 @@ rec { pivot = pivot' 1 { left = []; right = []; }; in if len < 2 then list - else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right); + else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right)); # Return the first (at most) N elements of a list. |