From 5116a523a9cedf5e2848ca4602d8f79866085e80 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Fri, 11 Jan 2008 16:58:55 +0000 Subject: [PATCH] A few library functions added. svn path=/nixpkgs/trunk/; revision=10118 --- pkgs/lib/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index ca90f957761..2d300891bcf 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -222,6 +222,19 @@ rec { in uniqList {outputList=newOutputList; inputList = (tail inputList);}; + uniqListExt = {inputList, outputList ? [], + getter ? (x : x), compare ? (x: y: x==y)}: + if (inputList == []) then outputList else + let x=head inputList; + isX = y: (compare (getter y) (getter x)); + newOutputList = outputList ++ + (if any isX outputList then [] else [x]); + in uniqListExt {outputList=newOutputList; + inputList = (tail inputList); + inherit getter compare; + }; + + condConcat = name: list: checker: if list == [] then name else