Cartesian product of two or more lists: Difference between revisions
Cartesian product of two or more lists (view source)
Revision as of 18:40, 22 June 2020
, 4 years agono edit summary
No edit summary |
|||
Line 2,221:
{}
</pre>
=={{header|Phixmonti}}==
<lang Phixmonti>include ..\Utilitys.pmt
def cart
( ) var res
-1 get var ta -1 del
-1 get var he -1 del
ta "" != he "" != and if
he len nip for
he swap get var h drop
ta len nip for
ta swap get var t drop
( h t ) flatten res swap 0 put var res
endfor
endfor
len if res 0 put cart endif
endif
enddef
/# ---------- MAIN ---------- #/
( ( 1 2 ) ( 3 4 ) ) cart
drop res print nl nl
( ( 1776 1789 ) ( 7 12 ) ( 4 14 23 ) ( 0 1 ) ) cart
drop res print nl nl
( ( 1 2 3 ) ( 30 ) ( 500 100 ) ) cart
drop res print nl nl
( ( 1 2 ) ( ) ) cart
drop res print nl nl</lang>
=={{header|PicoLisp}}==
|