-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add Array.take
method
#587
Conversation
Any feedback would be appreciated) |
Anything? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and thanks for the test. Sorry for the delay.
One possible objection is that the existing List.take has a less general signature and only takes a Nat, not an Int.
I'm ok with that but what do others think @rvanasa @ggreif @luc-blaeser @chenyan-dfinity?
Also, do we want a version for mutable arrays too?
The more general signature seems okay to me because it's still possible to pass a
+1 |
Looking at the module api, I see that most (but not all) operations only operate on immutable arrays. Instead of adding a mutable variant of just this operation ( So I'd say let's just merge this immutable We already have some historically inconsistent naming that it would be nice to resolve, eg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution and sorry for the delay!
Takes N elements from the start or end of the array