The invert
method for Lists should return the inverted sequence, or at least that's what the source seems to imply. However:
say (1,3,2).invert
fails with:
(exit code 1) Type check failed in invert; expected Pair but got Int (1) in block <unit>
The documentation does not help, because it's LTA in this area (and missing for List). But the source code does not admit any ambiguous interpretation. Is there anything I'm missing here?
Perhaps you intended to use the reverse method. Well, if you want the result to be (2,3,1)
.
It looks like the documentation of List.invert
is indeed missing. It is intended to work only on a List
that consists of Pair
s. I'll write that up now.
EDIT: doc added with https://github.com/perl6/doc/commit/0ee3245776
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With