Skip to content
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

Zip operator Z should return a list of parcels #1842

Closed
p6rt opened this issue Jun 17, 2010 · 6 comments
Closed

Zip operator Z should return a list of parcels #1842

p6rt opened this issue Jun 17, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jun 17, 2010

Migrated from rt.perl.org#75818 (status was 'resolved')

Searchable as RT75818$

@p6rt
Copy link
Author

p6rt commented Jun 17, 2010

From justin.sahs@gmail.com

ciphertext​: rakudo​: (1,2,3 Z 4,5,6).perl.say
p6eval​: rakudo c9ee2e​: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
ciphertext​: rakudo​: (1,2,3 Z[,] 4,5,6).perl.say
p6eval​: rakudo c9ee2e​: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
pmichaud​: > (1,2,3 Z[,] 4,5,6).perl.say
pmichaud​: ((1, 4), (2, 5), (3, 6))
pmichaud​: (in the new branch)
ciphertext​: pmichaud​: that's what i'm getting, but the spec says that Z
should be an alias for Z[,]
ciphertext​: "The Z, operator is perhaps more clearly written as Z[,].
However, this list form is common enough to have a shortcut, the ordinary
infix Z operator described earlier."
pmichaud​: sounds like a rakudo bug to me then.

Also from S03​:

1,2 Z 3,4 # (1,3),(2,4)

@p6rt
Copy link
Author

p6rt commented Jun 17, 2010

From justin.sahs@gmail.com

zip.patch
diff --git a/src/core/operators.pm b/src/core/operators.pm
index 7e02233..3726bc1 100644
--- a/src/core/operators.pm
+++ b/src/core/operators.pm
@@ -531,8 +531,7 @@ our multi sub infix:<Z>($lhs, $rhs) {
     gather while ?$lhs-list && ?$rhs-list {
         my $a = $lhs-list.shift;
         my $b = $rhs-list.shift;
-        take $a;
-        take $b;
+        take $a, $b;
     }
 }
 

@p6rt
Copy link
Author

p6rt commented Jul 28, 2010

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 4, 2011

From @coke

On Thu Jun 17 00​:38​:17 2010, ciphertext wrote​:

ciphertext​: rakudo​: (1,2,3 Z 4,5,6).perl.say
p6eval​: rakudo c9ee2e​: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
ciphertext​: rakudo​: (1,2,3 Z[,] 4,5,6).perl.say
p6eval​: rakudo c9ee2e​: OUTPUT«(1, 4, 2, 5, 3, 6)␤»
pmichaud​: > (1,2,3 Z[,] 4,5,6).perl.say
pmichaud​: ((1, 4), (2, 5), (3, 6))
pmichaud​: (in the new branch)
ciphertext​: pmichaud​: that's what i'm getting, but the spec says that
Z
should be an alias for Z[,]
ciphertext​: "The Z, operator is perhaps more clearly written as Z[,].
However, this list form is common enough to have a shortcut, the
ordinary
infix Z operator described earlier."
pmichaud​: sounds like a rakudo bug to me then.

Also from S03​:

1,2 Z 3,4 # (1,3),(2,4)

This appears to be working now​:

08​:45 < [Coke]> rakudo​: (1,2,3 Z[,] 4,5,6).perl.say
08​:45 <+p6eval> rakudo 7408d6​: OUTPUT«((1, 4), (2, 5), (3, 6)).list␤»
08​:45 < [Coke]> rakudo​: (1,2,3 Z, 4,5,6).perl.say
08​:45 <+p6eval> rakudo 7408d6​: OUTPUT«((1, 4), (2, 5), (3, 6)).list␤»

There's a test in S03-metaops/zip.t to make sure this parses, but not to
make sure it works.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 5, 2011

From @moritz

now tested in S03-metaops/zip.t

@p6rt
Copy link
Author

p6rt commented Oct 5, 2011

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant