Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need an API method "SLICE", as extension to AT-POS? #441

Open
lizmat opened this issue Oct 2, 2024 · 2 comments
Open

Do we need an API method "SLICE", as extension to AT-POS? #441

lizmat opened this issue Oct 2, 2024 · 2 comments
Labels
language Changes to the Raku Programming Language

Comments

@lizmat
Copy link
Collaborator

lizmat commented Oct 2, 2024

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 rakudo/rakudo#1639

@lizmat lizmat added the language Changes to the Raku Programming Language label Oct 2, 2024
@librasteve
Copy link

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

@0racle
Copy link

0racle commented Oct 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Changes to the Raku Programming Language
Projects
None yet
Development

No branches or pull requests

3 participants