Seems like you left out the degenerate case for when you run out of pairs:
sub infix:<!!> (Scalar $x, 0) { $x }
On 2005-08-05 16:24, "Yuval Kogman" <[EMAIL PROTECTED]> wrote:
> On Fri, Aug 05, 2005 at 11:36:16 -0700, Larry Wall wrote:
>
>> There's something to be said for having a way of indexing into that
>> using numeric subscripts. Certainly Lisp's extensible car/cdr notation
>> is the wrong way to do it, but cdddr is certainly shorter than
>>
>> $pair.value.value.value
>>
>> But maybe that's worth being dehuffmanized like that...
>
> Haskell has !! :
>
> sub infix:<!!> (Pair $x, 0) { $x.key }
> sub infix:<!!> (Pair $x, Int $index) { $x.value !! ($index - 1) }