diff --git a/src/core/Iterator.pm b/src/core/Iterator.pm index b4c4d7797ef..6545dd61dca 100644 --- a/src/core/Iterator.pm +++ b/src/core/Iterator.pm @@ -1,6 +1,15 @@ augment class Iterator { - multi method perl() { - $.eager.perl; + multi method perl(:$limit = 40) { + # Doing this right is probably beyond mortal dwimmery, + # and even in simple cases it needs the ability to + # serialize code to have any hope of producing + # output like (1, 1, * + * ... *) + # rather than (1, 1, 2, 3, 5, {???} ... ???). + # Try to do something useful for debugging, for now. + my @a = self.batch($limit); + my $and_more = ''; + $and_more = ', {???} ... ???' if @a == $limit; + '(' ~ @a.map({ $^a.perl }).join(', ') ~ $and_more ~ ')'; } multi method elems() { diff --git a/src/core/Seq.pm b/src/core/Seq.pm index a7b95c2a456..b3459ffa0be 100644 --- a/src/core/Seq.pm +++ b/src/core/Seq.pm @@ -88,6 +88,10 @@ augment class Seq { multi method fmt($format = '%s', $seperator = ' ') { self.map({ .fmt($format)}).join($seperator); } + + method perl() { + '(' ~ self.map({ $^a.perl }).join(', ') ~ ')'; + } } multi sub sort (@x, :&by = &infix:) { @x.sort(&by) }