After thinking about this a bit, I'm inclined to disagree with the 
original ticket.

    my %h = 'foo' => [1,2,3], 'bar' => [4,5,6];

If %h{*} is analogous to @array[*], then it returns a list (slice) of 
all of the elements of %h.  The .[1] should then return the second 
element of this slice, which would be either [1,2,3] or [4,5,6] 
depending on the order in which the values were returned from %h{*}.

The real way to grab the second element from each array in the hash 
would be something like:

   %h{*}ยป.[1]

which would apply the .[1] to each array returned from the hash.  
Unfortunately this also relies on "duck mapping" of the hyper as defined 
in S03, which as yet is NYI in Rakudo.  (And implementing S03's duck 
mapping will require some refactoring of postcircumfix:<[ ]> and 
postcircumfix:<{ }>.

To get the (2,5) expected from the original ticket likely requires 
something like:

    > my %h = 'foo' => [1,2,3], 'bar' => [4,5,6];  say (.[1] for 
%h{*}).perl
    (2, 5).list


The other possible mechanism for multidimensional slice subscripting is 
defined in S09 using semicolons, as in something like %h{*;1}.  However, 
that requires declared dimensioned hashes and/or arrays (which the 
example is not), and I'm not sure that syntax will work for mixed 
hash/array structures.

So, we can either reject this ticket, or we can maybe convert it to a 
ticket that notes that "duck mapping" of hypers is NYI in Rakudo 
(although I'm not convinced that duck mapped hypers is the correct 
solution to the overall problem with hypers).

Pm

Reply via email to