Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix Seq.perl to not say Seq.new(). Interim fix for Iterator.perl infi…

…nite loops.
  • Loading branch information...
commit d952fc4b1d052c0b2f6cce2ae2f26ab813776a61 1 parent 5c8257f
@quester quester authored colomon committed
Showing with 15 additions and 2 deletions.
  1. +11 −2 src/core/Iterator.pm
  2. +4 −0 src/core/Seq.pm
View
13 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() {
View
4 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:<cmp>) { @x.sort(&by) }
Please sign in to comment.
Something went wrong with that request. Please try again.