diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/lib/lists.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/lib/lists.nix | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/infra/libkookie/nixpkgs/lib/lists.nix b/infra/libkookie/nixpkgs/lib/lists.nix index f424946c72cd..06cee2eb112a 100644 --- a/infra/libkookie/nixpkgs/lib/lists.nix +++ b/infra/libkookie/nixpkgs/lib/lists.nix @@ -1,9 +1,9 @@ # General list operations. { lib }: -with lib.trivial; let inherit (lib.strings) toInt; + inherit (lib.trivial) compare min; in rec { @@ -640,13 +640,7 @@ rec { unique [ 3 2 3 4 ] => [ 3 2 4 ] */ - unique = list: - if list == [] then - [] - else - let - x = head list; - in [x] ++ unique (remove x list); + unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) []; /* Intersects list 'e' and another list. O(nm) complexity. |