3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
Michael Raskin 2007-10-27 17:54:20 +00:00
parent f91588a53f
commit 98a0a257e0

View file

@ -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