You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Protovis supported functionality similar to this with pv.min.index and pv.max.index. Perhaps it’d be sufficient to support just the minimum and maximum index, since that could be used to extract the element.
The text was updated successfully, but these errors were encountered:
Another thought is a “scan” method that takes a comparator and returns the index of the least element according to the comparator. Sort of like bisect, but in linear time for unsorted arrays.
But this returns the first (or last) value, not the index. Also, I don’t see a great reason to have both a first and a last method given that you can just invert the comparator.
Related d3/d3#1964.
Currently, min and max return the minimum and maximum value from an array of elements, using an optional value accessor.
In some cases, it might be nice to either return the minimum or maximum index of a given element, or the element itself. For example:
Protovis supported functionality similar to this with pv.min.index and pv.max.index. Perhaps it’d be sufficient to support just the minimum and maximum index, since that could be used to extract the element.
The text was updated successfully, but these errors were encountered: