+ our List multi method pairs(@values: *...@indices) { + gather { + for (@values.keys Z @values) -> $key, $val is rw { + take ($key => $val) + unless (@indices && ($key !~~ any(@indices))); + } + } + }
Especially in class C<Any>, we should _not_ be placing any constraints on the invocant -- the above use of @values would constrain this to be an array. Change it to be $values, or (even better) just use 'self'. Instead of doing a test for @indices in each iteration I'd think we could do the test once at the beginning and decide which path we're likely to take from there. Pm