-
Notifications
You must be signed in to change notification settings - Fork 320
Methods .mapv(), .mapv_into(), .apply(), .applyv(), .visit() #159
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
Conversation
I am taking suggestions for a good naming scheme for the methods .map(), .mapv(), .apply(), .applyv(), .visit(). We do want them all as this kind of "internal iteration" or closure visiting; it's the only way we can optimize the traversal across nested loops if needed. We do want both .map and .mapv and the same with .apply, .applyv, because the by value methods are so convenient for numerical code. |
Map should definitely stay map. |
Thanks for the input! They will be next to each other in the docs, so I hope you'd see them there. This is tricky because mathematically, all four methods do the same thing. So we're trying to find words for that.. |
Oh no, there's yet another one that comes up, Again, all of these are the same mathematically, just with different rust type system effects. .map(&self, |&A| -> B) -> OwnedArray<B, D>
.mapv(&self, |A| -> B) -> OwnedArray<B, D>
.mapv_into(self, |A| -> A) -> Self
.apply(&mut self, |&mut A|)
.applyv(&mut self, |A| -> A)
.visit(&self, |&A|) |
4d09f58
to
d52e432
Compare
Methods .mapv(), .mapv_into(), .apply(), .applyv(), .visit()
Fixes #58
Fixes #153
I did experiment with a trait to unify the map and mapv case into a single method, and while it worked, it also introduced type inference ambiguities everywhere, so it was so much less useful.