June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,10 +1,15 @@
|
|||
sub partition(@mask is copy) {
|
||||
my $last = [+] @mask or return [[] xx @mask];
|
||||
sort gather for @mask.kv -> $k,$v {
|
||||
my @op;
|
||||
my $last = [+] @mask or return [] xx 1;
|
||||
for @mask.kv -> $k, $v {
|
||||
next unless $v;
|
||||
temp @mask[$k] -= 1;
|
||||
for partition @mask { .take.[$k].push($last) }
|
||||
for partition @mask -> @p {
|
||||
@p[$k].push: $last;
|
||||
@op.push: @p;
|
||||
}
|
||||
}
|
||||
return @op;
|
||||
}
|
||||
|
||||
.perl.say for partition [2,0,2];
|
||||
.say for reverse partition [2,0,2];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue