Factorial base numbers indexing permutations of a collection: Difference between revisions
Content deleted Content added
Added Go |
m →{{header|zkl}}: play with formatting |
||
Line 414:
omega
}</lang>
<lang zkl>foreach a,b,c in (4,3,2){
println("%d.%d.%d --> %s".fmt(a,b,c, fpermute(
}</lang>
{{out}}
<pre style="height:35ex">
0.0.0 --> 0123
0.0.1 --> 0132
Line 447 ⟶ 446:
3.2.1 --> 3210
</pre>
<lang zkl>deck:=List();
foreach s,c in ("\u2660 \u2665 \u2666 \u2663".split(),
"A K Q J 10 9 8 7 6 5 4 3 2".split()){ deck.append(c+s) }
Line 459 ⟶ 458:
{{out}}
<pre>
A♣3♣7♠4♣10♦8♦Q♠K♥2♠10♠4♦7♣J♣5♥10♥10♣K♣2♣3♥5♦J♠6♠Q♣5♠K♠A♦3♦Q♥8♣6♦9♠8♠4♠9♥A♠6♥5♣2♦7♥8♥9♣6♣7♦A♥J♦Q♦9♦2♥3♠J♥4♥K♦
2♣5♣J♥4♥J♠A♠5♥A♣6♦Q♠9♣3♦Q♥J♣10♥K♣10♣5♦7♥10♦3♠8♥10♠7♠6♥5♠K♥4♦A♥4♣2♥9♦Q♣8♣7♦6♣3♥6♠7♣2♦J♦9♥A♦Q♦8♦4♠K♦K♠3♣2♠8♠9♠
</pre>
<lang zkl>r:=[52..2,-1].pump(List,(0).random);
println(r.concat("."),"\n",fpermute(deck,r).concat(""));</lang>
{{out}}
<pre>
36.21.48.31.19.37.16.39.43.1.27.23.30.22.14.32.31.2.27.11.5.24.28.20.23.20.17.19.23.13.11.12.3.12.1.0.11.1.8.10.6.2.8.3.7.1.1.4.2.2.1
4♦6♥3♣8♦8♥Q♣J♥8♣2♣K♠9♦K♦2♦A♦Q♥9♣10♣J♠A♣A♥7♠3♦5♣10♦K♣7♦2♥6♦4♣7♥10♥5♥9♠3♥Q♠A♠J♦8♠4♥J♣K♥5♠7♣3♠6♣6♠4♠5♦9♥Q♦2♠10♠
|