From 3e71355377c0719bac49c3e3cf35dc93e6bc0dd3 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Tue, 15 Mar 2011 09:24:47 +0000 Subject: [PATCH] Add two 'remove' functions svn path=/nixpkgs/branches/stdenv-updates/; revision=26311 --- pkgs/lib/lists.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix index 36fa236304d..d1cdf5b68ab 100644 --- a/pkgs/lib/lists.nix +++ b/pkgs/lib/lists.nix @@ -50,6 +50,11 @@ rec { filter = pred: list: fold (x: y: if pred x then [x] ++ y else y) [] list; + # Remove elements 'e' from a list. Useful for buildInputs + remove = e: filter (x: x != e); + + # Given two lists, removes all elements of the first list from the second list + removeList = l: filter (x: elem x l); # Return true if `list' has an element `x': elem = x: list: fold (a: bs: x == a || bs) false list;