Sometimes I feel the absence of a SLICE method, essentially doing:
method SLICE(@pos) {
my @values;
@values.push(self.AT-POS($_)) for @pos;
@values
}
Making this part of the internal API, would allow for several optimizations, e.g. when working on fully reified lists / arrays and given a Range.
while low level for many uses, i am a big fan of slice as an all encompassing low level api for lists, arrays and so on … definitely support this idea
Yes please. I've thought about supporting Array access on Noun objects in Inline::J, and a SLICE method that receives all the positions requested would be very useful.
Sometimes I feel the absence of a SLICE method, essentially doing:
method SLICE(@pos) { my @values; @values.push(self.AT-POS($_)) for @pos; @values } Making this part of the internal API, would allow for several optimizations, e.g. when working on fully reified lists / arrays and given a Range.
Moved from https://github.com/rakudo/rakudo/issues/1639