Carl MXXsak (via RT) wrote: > # New Ticket Created by "Carl Mäsak" > # Please include the string: [perl #58526] > # in the subject line of all future correspondence about this issue. > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58526 > > > > r30698: > $ ./perl6 -e 'say [1,2,3,4,5,6].pick(*)' # expected > 645213 > > $ ./perl6 -e 'say [[1,2,3],[4,5,6]].pick(*)' # strange... > 1234 > $ ./perl6 -e 'say [[1,2,3],[4,5,6]].pick(*)' # ... > 4561 > > The semantics seem to be that one array is randomly picked, flattened, > and then a random element from the other array is picked. Not very > intuitive behaviour, and probably not intended.
Actually the array is just flattened before picking: ./perl6 -e 'say [[1,2,3],[4,5,6]].pick(*).perl' [4, 5, 6, 3] The same happens for other operations where a nested array is accessed: ./perl6 -e 'my %a = (a => [[1,2,3],[4,5,6]]); say %a<a>.perl' [1, 2, 3, 4, 5, 6] > A saner behaviour would be for pick not to flatten elements which > happen to be arrays. Indeed. Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/