Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rewrite Any.join() to avoid the "Cannot reduce() empty list" error.
Might as well use the Parrot 'join' opcode since we have one.
  • Loading branch information
pmichaud committed May 2, 2009
1 parent ec69e24 commit cacc976
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/setting/Any-list.pm
Expand Up @@ -11,8 +11,14 @@ class Any is also {
}
}

our Str multi method join(Str $separator = '') {
@.list.reduce({ $^a ~ $separator ~ $^b })
our Str multi method join($separator = '') {
Q:PIR {
$P0 = self.'list'()
$P1 = find_lex '$separator'
$S1 = $P1
$S0 = join $S1, $P0
%r = box $S0
}
}
our List multi method map(*&expr) {
Expand Down

0 comments on commit cacc976

Please sign in to comment.