Cartesian product of two or more lists: Difference between revisions

Content added Content deleted
m (→‎version 1: changed DO-END comments to match the DO statements.)
Line 2,508: Line 2,508:
do b=1 for words(x.j) /* " " elements of subsequent list*/
do b=1 for words(x.j) /* " " elements of subsequent list*/
$=$',('word(x.i, a)","word(x.j, b)')' /*append partial cartesian product ──►$*/
$=$',('word(x.i, a)","word(x.j, b)')' /*append partial cartesian product ──►$*/
end /*jj*/
end /*b*/
end /*j */
end /*j*/
end /*ii*/
end /*a*/
end /*i */
end /*i*/
say 'Cartesian product of ' space(@.n) " is ───► {"substr($, 2)'}'
say 'Cartesian product of ' space(@.n) " is ───► {"substr($, 2)'}'
end /*n */ /*stick a fork in it, we're all done. */</lang>
end /*n */ /*stick a fork in it, we're all done. */</lang>