Cartesian product of two or more lists: Difference between revisions

Content added Content deleted
(→‎Functional JS: Reformulated in terms of Array.flatMap)
Line 1,088: Line 1,088:
===ES6===
===ES6===
====Functional====
====Functional====
Cartesian products fall quite naturally out of '''concatMap''', and its argument-flipped twin '''bind'''.
Cartesian products fall quite naturally out of '''concatMap''' (Array.flatMap), and its argument-flipped twin '''bind'''.


For the Cartesian product of just two lists:
For the Cartesian product of just two lists: