From ea13e2aa87f2be34b3c66f3a65cc4400ed00f96a Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Sat, 28 Feb 2015 04:02:15 +0100 Subject: [PATCH] lib/lists: add intersect and substract functions --- lib/lists.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/lists.nix b/lib/lists.nix index d57c4893daa..2dda700bef3 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)); }