Cartesian product of two or more lists: Difference between revisions
Cartesian product of two or more lists (view source)
Revision as of 20:01, 31 July 2023
, 10 months agono edit summary
(Erlang version) |
mNo edit summary |
||
Line 1,637:
end program cartesian_product
</syntaxhighlight>
{{out}}
{3,4} x {1,2} = {{3,1},{3,2},{4,1},{4,2}}
{1,2} x {} = {}
{} x {1,2} = {}</pre>
=={{header|FreeBASIC}}==
I'll leave the extra credit part for someone else. It's just going to amount to repeatedly finding Cartesian products and [[Flatten a list|flattening]] the result, so considerably less interesting than Cartesian products where the list items themselves can be lists.
Line 1,714 ⟶ 1,713:
{}
</pre>
=={{header|Fōrmulæ}}==
|