summaryrefslogtreecommitdiffstats
path: root/lib/lists.nix
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-12-12 13:10:30 -0500
committerShea Levy <shea@shealevy.com>2013-12-12 13:10:41 -0500
commita42508a8ba3f0cba2b62c138f242461e302e96df (patch)
tree30b6202e002f4b92d9dfc78ef4323a990eb2212f /lib/lists.nix
parente69887ea67297b99f3c89f58fc2486c2e0dd1cfc (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/lists.nix')
-rw-r--r--lib/lists.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/lists.nix b/lib/lists.nix
index d6e8628f03a1..561a657264bb 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;
}