Skip to content

Commit

Permalink
* Allow for .perl to output nested arrays and empty arrays
Browse files Browse the repository at this point in the history
	modified:   src/core/List.pm
  • Loading branch information
unobe committed Dec 25, 2009
1 parent 78e4226 commit c9b8720
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/List.pm
@@ -1,12 +1,13 @@
augment class List {
method perl() {
if self.elems() == 0 { return Nil.WHAT };
# '(' ~ self.map({ $_.perl }).join(', ') ~ ')';
my $result = "(";
my $result = '(';
for self -> $x {
$result ~= ", " if $result.chars > 1;
$result ~= $x.perl;
$result ~= ', ' if $result.chars > 1;
$result ~= (~$x.WHAT eq 'Array()' ?? gather { for 0 ... $x.end { take $x.[$_] } } !! $x).perl;
}
return $result ~ ")";
return $result ~ ')';
}
}

Expand Down

0 comments on commit c9b8720

Please sign in to comment.