New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Seq.perl to not say Seq.new(). Interim fix for Iterator.perl to fix infinite loops #1708
Comments
From quester.pm@gmail.comHello, I noticed finanalyst having problems with Rakudo on #perl6 on 2010-04-20: 05:36 finanalyst alpha: my @a = 1,2,3,4; my %h; %h{@a[0]} = @a[1 ..^ +@a]; The fix was just to copy the perl method from Array.pm to Seq.pm (and change I also remembered how many times I have been annoyed with Rakudo going into my $a=(1,1,* + * ... *); $a.perl.say; There was some discussion around 10:54 UTC 2010-04-20 on #perl6 about the I include some comments in Iterator.pm to indicate that the code is a Please let me know if you have any questions or suggestions. Best regards, |
From quester.pm@gmail.com0001-Fix-Seq.perl-to-not-say-Seq.new-.-Interim-fix-for-It.patchFrom 54ab1068bff26928c2920598a8d53ac1cab8ef21 Mon Sep 17 00:00:00 2001
From: quester <quester.pm@gmail.com>
Date: Tue, 20 Apr 2010 00:20:12 -1000
Subject: [PATCH] Fix Seq.perl to not say Seq.new(). Interim fix for Iterator.perl infinite loops.
---
src/core/Iterator.pm | 13 +++++++++++--
src/core/Seq.pm | 4 ++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/core/Iterator.pm b/src/core/Iterator.pm
index b4c4d77..6545dd6 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 a7b95c2..b3459ff 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:<cmp>) { @x.sort(&by) }
--
1.6.6.1
|
From @questerThis is a fix for RT #74518 "[BUG] rakudo regression .perl". Sorry, I |
From @moritzApplied by colomon++ as d952fc4b1d052c0b2f6cce2ae2f26ab813776a61 |
@moritz - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#74526 (status was 'resolved')
Searchable as RT74526$
The text was updated successfully, but these errors were encountered: