diff options
-rw-r--r-- | lib/lists.nix | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/lists.nix b/lib/lists.nix index 6c97e0686aa8..06cee2eb112a 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -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. |