Skip to content

Commit

Permalink
Simplify and optimize the trivial case of Str.comb(). RT #85602
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed May 1, 2011
1 parent 8533c3c commit 6ca6140
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/Cool-str.pm
Expand Up @@ -54,7 +54,13 @@ augment class Cool {
$result;
}

multi method comb(Regex $matcher = /./, $limit = *, :$match) {
multi method comb() {
gather for 1..self.chars {
take self.substr($_ - 1, 1);
}
}

multi method comb(Regex $matcher, $limit = *, :$match) {
my $self-string = ~self;
my $c = 0;
my $l = $limit ~~ ::Whatever ?? Inf !! $limit;
Expand Down

0 comments on commit 6ca6140

Please sign in to comment.