Cartesian product of two or more lists: Difference between revisions

Content added Content deleted
(→‎Functional JS: Updated applicative version)
Line 1,092: Line 1,092:
For the Cartesian product of just two lists:
For the Cartesian product of just two lists:
<lang JavaScript>(() => {
<lang JavaScript>(() => {
// CARTESIAN PRODUCT OF TWO LISTS -----------------------------------------
// CARTESIAN PRODUCT OF TWO LISTS ---------------------


// cartProd :: [a] -> [b] -> [[a, b]]
// cartProd :: [a] -> [b] -> [[a, b]]
Line 1,099: Line 1,099:




// TEST -------------------------------------------------------------------
// TEST -----------------------------------------------
return [
return [
cartProd([1, 2])([3, 4]),
cartProd([1, 2])([3, 4]),