Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simplify grep and friends on Set/Bag/Mix
Since Set is now also returning pairs for .list
  • Loading branch information
lizmat committed Aug 28, 2015
1 parent 441d54d commit 7591fc4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/core/Baggy.pm
Expand Up @@ -76,8 +76,6 @@ my role Baggy does QuantHash {
~ ").{self.^name}"
}

multi method list(Baggy:D:) { self.pairs }

proto method grabpairs (|) { * }
multi method grabpairs(Baggy:D:) {
%!elems.DELETE-KEY(%!elems.keys.pick);
Expand Down
4 changes: 2 additions & 2 deletions src/core/QuantHash.pm
Expand Up @@ -4,6 +4,8 @@ my role QuantHash does Associative {
method Numeric ( --> Numeric) { self.total.Numeric }
method Real ( --> Real) { self.total.Real }

method list() { self.pairs }

method minpairs {
my @found;
my $min = Inf;
Expand Down Expand Up @@ -50,8 +52,6 @@ my role QuantHash does Associative {
self.pairs.fmt($format, $sep);
}
}

multi method grep(QuantHash:D: Mu $test) { self.pairs.grep($test) }
}

# vim: ft=perl6 expandtab sw=4
1 change: 0 additions & 1 deletion src/core/Setty.pm
Expand Up @@ -66,7 +66,6 @@ my role Setty does QuantHash {
~ ')';
}

multi method list(Setty:D:) { %!elems.values }
multi method pairs(Setty:D:) { %!elems.values.map: { $_ => True } }
multi method antipairs(Setty:D:) { %!elems.values.map: { True => $_ } }
method grab(Setty:D: $count = 1) {
Expand Down

0 comments on commit 7591fc4

Please sign in to comment.