Cartesian product of two or more lists: Difference between revisions
Content added Content deleted
m (→{{header|Tailspin}}: update syntax) |
|||
Line 3,390: | Line 3,390: | ||
templates cartesianProduct |
templates cartesianProduct |
||
{ product: [$(1)... -> [$]], rest: $(2..last) } -> # |
{ product: [$(1)... -> [$]], rest: $(2..last) } -> # |
||
<{ rest: <[](0)> }> $.product ! |
when <{ rest: <[](0)> }> do $.product ! |
||
otherwise def m: $.rest(1); |
|||
{ product: [$.product... -> \(def n: $; $m... -> [$n..., $] !\)], rest: $.rest(2..last) } -> # |
{ product: [$.product... -> \(def n: $; $m... -> [$n..., $] !\)], rest: $.rest(2..last) } -> # |
||
end cartesianProduct |
end cartesianProduct |