diff options
author | Shea Levy <shea@shealevy.com> | 2013-12-12 13:10:30 -0500 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2013-12-12 13:10:41 -0500 |
commit | a42508a8ba3f0cba2b62c138f242461e302e96df (patch) | |
tree | 30b6202e002f4b92d9dfc78ef4323a990eb2212f /lib | |
parent | e69887ea67297b99f3c89f58fc2486c2e0dd1cfc (diff) |
Add function to call a function with a cross-product of lists of arguments
Signed-off-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lists.nix | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/lists.nix b/lib/lists.nix index d6e8628f03a14..561a657264bbb 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -225,4 +225,10 @@ in rec { 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; } |