bisectCenter naming
dakoop opened this issue · comments
I find it unintuitive that bisectCenter
can return a value that is less than both bisectLeft
and bisectRight
. Based on how bisectLeft
and bisectRight
work, I would expect bisectCenter
to either match bisectLeft
and bisectRight
(if the value doesn't exist in the array) or give me the index in the middle of a sequence of equal values. Reading the documentation and #138, I now understand that this method is accomplishing something different.
To me, it would make sense to rename this method to something like closestIndex
(even though the implementation uses a bisector). One could also rename bisector
to locator
or something more general and then have bisectLeft
, bisectRight
, and closestIndex
instead of .left
, .right
, and .center
.
Thanks for the feedback. I understand that the name could be confusing, but I’d rather just leave it as is now.