-
Notifications
You must be signed in to change notification settings - Fork 360
Closed as not planned
Description
I have a function that I am mapping along an axis of an array to reduce it, but it doesn't return a single value but rather a tuple.
let tuple_values = arr.map_axis(Axis(0), reduce_to_tuple);
To get the values as separate arrays I am currently doing this
let val1 = tuple_values.mapv(|(x, _)| x);
let val2 = tuple_values.mapv(|(_, x)| x);
I was wondering whether there is a simpler way to unzip an array of tuples, e.g. along the lines of
let (val1, val2) = arr.map_axis(Axis(0), reduce_to_tuple).unzip();
ALos it isn't necessarily a 2-tuple but could be e.g. a 3-tuple, ...
Metadata
Metadata
Assignees
Labels
No labels