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:
parent
f91588a53f
commit
98a0a257e0
@ -9,6 +9,10 @@ in
|
|||||||
|
|
||||||
rec {
|
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
|
# "Fold" a binary function `op' between successive elements of
|
||||||
# `list' with `nul' as the starting value, i.e., `fold op nul [x_1
|
# `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
|
# x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'. (This is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user