query
On this page

crossLists

lib.lists.crossLists

Docs pulled from | This Revision | 4 days ago


Returns the image of the cross product of some lists by a function.

Examples

lib.lists.crossLists usage example

crossLists (x: y: "${toString x}${toString y}") [[1 2] [3 4]]
=> [ "13" "14" "23" "24" ]

If you have an attrset already, consider mapCartesianProduct:

mapCartesianProduct (x: "${toString x.a}${toString x.b}") { a = [1 2]; b = [3 4]; }
=> [ "13" "14" "23" "24" ]

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

crossLists = f: foldl (fs: args: concatMap (f: map f args) fs) [ f ];