From ea13e2aa87f2be34b3c66f3a65cc4400ed00f96a Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sat, 28 Feb 2015 04:02:15 +0100 Subject: lib/lists: add intersect and substract functions --- lib/lists.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/lists.nix') diff --git a/lib/lists.nix b/lib/lists.nix index d57c4893daa8..2dda700bef3b 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -233,4 +233,9 @@ rec { xs = unique (drop 1 list); in [x] ++ remove x xs; + # Intersects list 'e' and another list + intersect = e: filter (x: elem x e); + + # Substracts list 'e' from another list + substract = e: filter (x: !(elem x e)); } -- cgit 1.4.1