Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
sub insert($x, @xs) { ([flat @xs[0 ..^ $_], $x, @xs[$_ .. *]] for 0 .. +@xs) }
|
||||
sub order($sg, @xs) { $sg > 0 ?? @xs !! @xs.reverse }
|
||||
|
||||
multi perms([]) {
|
||||
[] => +1
|
||||
}
|
||||
|
||||
multi perms([$x, *@xs]) {
|
||||
perms(@xs).map({ |order($_.value, insert($x, $_.key)) }) Z=> |(+1,-1) xx *
|
||||
}
|
||||
|
||||
.say for perms([0..2]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue