git.iko.soy/typeable/nixpkgs
on master help sign in
lib/lists: add intersect and substract functions
ea13e2aJaka Hudoklin
lib/lists.nix+5
@@ -233,4 +233,9 @@ rec {
233 xs = unique (drop 1 list);
233 xs = unique (drop 1 list);
234 in [x] ++ remove x xs;
234 in [x] ++ remove x xs;
235
235
236+ # Intersects list 'e' and another list
237+ intersect = e: filter (x: elem x e);
238+
239+ # Substracts list 'e' from another list
240+ substract = e: filter (x: !(elem x e));
236}
241}