Skip to content

Commit

Permalink
Fix problem with set multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Sep 10, 2013
1 parent 63dca5d commit 51aa2c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/core/Baggy.pm
Expand Up @@ -214,9 +214,14 @@ my role Baggy does Associative {
}

only sub infix:<(.)>(**@p) {
my $set = Set.new: @p.map(*.Set(:view).keys);
my @bags = @p.map(*.Bag(:view));
Bag.new-fp($set.map({ ; $_ => [*] @bags>>.{$_} }));
my $keybag = @p.shift.KeyBag;
for @p.map(*.Bag(:view)) -> $bag {
$bag{$_}
?? $keybag{$_} *= $bag{$_}
!! $keybag.delete($_)
for $keybag.keys;
}
$keybag.Bag(:view);
}
# U+228D MULTISET MULTIPLICATION
only sub infix:<<"\x228D">>(|p) {
Expand Down

0 comments on commit 51aa2c8

Please sign in to comment.