Add unique
list function
It removes duplicate elements from a list.
This commit is contained in:
parent
3b0fa60a98
commit
1fea5866ae
@ -223,4 +223,14 @@ rec {
|
||||
|
||||
crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [f];
|
||||
|
||||
# Remove duplicate elements from the list
|
||||
unique = list:
|
||||
if list == [] then
|
||||
[]
|
||||
else
|
||||
let
|
||||
x = head list;
|
||||
xs = unique (drop 1 list);
|
||||
in [x] ++ remove x xs;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user