Add function to call a function with a cross-product of lists of arguments

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-12-12 13:10:30 -05:00
parent e69887ea67
commit a42508a8ba
1 changed files with 6 additions and 0 deletions

View File

@ -225,4 +225,10 @@ in rec {
deepSeqList = xs: y: if any (x: deepSeq x false) xs then y else y; deepSeqList = xs: y: if any (x: deepSeq x false) xs then y else y;
crossLists = f: xss:
let
argss = fold (l: argss:
concatMap (arg: map (args: [ arg ] ++ args) argss) l
) [[]] xss;
in map (args: foldl (f: arg: f arg) f args) argss;
} }