Jump to content

Cartesian product of two or more lists: Difference between revisions

m
no edit summary
(Erlang version)
mNo edit summary
Line 1,637:
end program cartesian_product
</syntaxhighlight>
{{out}}
'''Output:'''
<pre> {1,2} x {3,4} = {{1,3},{1,4},{2,3},{2,4}}
{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æ}}==
 
2,161

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.