-
Notifications
You must be signed in to change notification settings - Fork 308
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 method to modify elements in place #153
Comments
We want to find a nice convention to make it consistent. Maybe something like this, saying map for an operation that makes a new array, and apply for modifying in place. Since all the float functions are by value " .map(&self, |&A| -> B) -> OwnedArray<B, D>
.mapv(&self, |A| -> B) -> OwnedArray<B, D>
.apply(&mut self, |&mut A|)
.applyv(&mut self, |A| -> A)
.visit(&self, |&A|) |
Maybe the map operations could be lazy like iterator adapters. A |
That's a nice idea. It's similar to this #88 (comment) Making an operation an object that itself can participate in operations on arrays makes particular sense in an even more generic-heavy implementation. For that reason ndarray will not take that route now, I think. |
A value-to-value mapper would be convenient, something like
array.apply(f32::abs)
it could even be calledlift
.The text was updated successfully, but these errors were encountered: