On IRC I said this was a bug, because the behaviour seemed so surprising, but 
now that I made a fix for it (diff attached), I find breakage in 
t/spec/S03-metaops/zip.t and t/spec/S32-container/roundrobin.t that test for 
what I see is a contradictory (to this ticket) behaviour for RT#126522.

Basically roundrobin, zip, and a few others aren't meant to treat itemized 
lists as lists and instead treat them as a single item. This is why the 
behaviour in this ticket is observed: array's elements are itemized and so get 
treated differently.

So.... this is just a pitfall of sorts and isn't a bug?

diff --git a/src/core/List.pm b/src/core/List.pm
index 4edd254..172009b 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -1593,14 +1593,14 @@ multi sub infix:<Z>(+lol) {
     return Seq.new(Rakudo::Internals.EmptyIterator) if $arity == 0;
     eager my @l = (^$arity).map: -> $i {
         my \elem = lol[$i];
-        if nqp::iscont(elem) {
-            $laze = False;
-            Rakudo::Internals.WhateverIterator((elem,))
-        }
-        else {
+        if nqp::istype(elem, Iterable) {
             $laze = False unless elem.is-lazy;
             Rakudo::Internals.WhateverIterator(elem)
         }
+        else {
+            $laze = False;
+            Rakudo::Internals.WhateverIterator((elem,))
+        }
     }
 
     gather {
@@ -1622,13 +1622,13 @@ my &zip := &infix:<Z>;
 sub roundrobin(**@lol is raw) {
     my $laze = False;
     my @iters = do for @lol -> \elem {
-        if nqp::iscont(elem) {
-            (elem,).iterator
-        }
-        else {
+        if nqp::istype(elem, Iterable) {
             $laze = True if elem.is-lazy;
             elem.iterator
         }
+        else {
+            (elem,).iterator
+        }
     }
     gather {
         while @iters {

Reply via email to