Anonymous user
Cartesian product of two or more lists: Difference between revisions
Cartesian product of two or more lists (view source)
Revision as of 15:45, 15 December 2019
, 4 years ago→{{header|Clojure}}
Line 558:
]
]
(println lst
(pp/pprint (cart lst)))
</lang>
<pre>
[[1 2] [3 4]] =>
((1 3) (2 3) (1 4) (2 4))
[[3 4] [1 2]] =>
((3 1) (4 1) (3 2) (4 2))
[[] [1 2]] =>
()
[[1 2] []] =>
()
[[1776 1789] [7 12] [4 14 23] [0 1]] =>
((1776 7 4 0)
(1789 7 4 0)
Line 596:
(1776 12 23 1)
(1789 12 23 1))
[[1 2 3] [30] [500 100]] =>
((1 30 500) (2 30 500) (3 30 500) (1 30 100) (2 30 100) (3 30 100))
[[1 2 3] [] [500 100]] =>
()
</pre>
|