From 98a0a257e0597d23afa5b1cab88e2ce42e65d4fd Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sat, 27 Oct 2007 17:54:20 +0000 Subject: [PATCH] Added sumArgs - it takes a function and gives a function to accpet any number of arguments and then (after getting null) apply original function to the resulting attribute set. svn path=/nixpkgs/trunk/; revision=9542 --- pkgs/lib/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix index 1a5dddecdfe..e631bca4c60 100644 --- a/pkgs/lib/default.nix +++ b/pkgs/lib/default.nix @@ -9,6 +9,10 @@ in rec { + innerSumArgs = f : x : y : (if y == null then (f x) + else (innerSumArgs f (x // y))); + sumArgs = f : innerSumArgs f {}; + # "Fold" a binary function `op' between successive elements of # `list' with `nul' as the starting value, i.e., `fold op nul [x_1 # x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is