+Alternately, C<*+0> is the first element, and the subscript dwims
+from the front or back depending on the sign.  That would be more
+symmetrical, but makes the idea of C<*> in a subscript a little more
+distant from the notion of "all the keys", which would be a loss,
+and potentially makes C<+*> not mean the number of keys.

The distinction of the three cases would be through dispatch
to different functions. The plain * goes to
&postcircumfix<[ ]>:(Array,Whatever) while the other two go
to &infix:<+>(Whatever,Int) and &infix:<->:(Whatever,Int)
respectively. In the latter cases the Whatever type somehow must
package the array. Perhaps it is actually Whatever of Array or
somesuch. The return value is a normal Int suitable for indexing
the array. Perhaps we need to restrict the second parameter to
UInt unless these two operators wrap around depending on sign ;)
That is @array[*+(-1)] actually retrieves that last entry and
@array[*-(-1)] the first =:()

Can the index be set up before using it in an array index?

   my @a = 1,2,3;
   my $x = *-1;
   say @a[$x]; # prints 3

Would &infix:<-> return a lazy Whatever value that becomes
a specific index when it hits &postcircumfix<[ ]>? That is
we have something like Whatever arithmetic?

Regards, TSa.

Reply via email to