git.iko.soy/typeable/nixpkgs
on master help sign in
lib/lists: add intersect and substract functions
commitea13e2aa87f2be34b3c66f3a65cc4400ed00f96a authorJaka Hudoklin <jakahudoklin@gmail.com> dateSat 28 Feb 2015, 04:02 (12 years ago) parentc4ae25e
1 file changed+5
lib/lists.nix+5
lib/lists.nix+5
@@ -233,4 +233,9 @@ rec {
233233 xs = unique (drop 1 list);
234234 in [x] ++ remove x xs;
235235
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));
236241}