Issue #7725 has been reported by marcandre (Marc-Andre Lafortune). ---------------------------------------- Bug #7725: bsearch should return enumerator when called without a block https://bugs.ruby-lang.org/issues/7725 Author: marcandre (Marc-Andre Lafortune) Status: Open Priority: Normal Assignee: Category: core Target version: 2.0.0 ruby -v: r38825 bsearch should return enumerator when called without a block This would allow, for example values.bsearch.with_index{|val, index| val >= some_array[index]} # => a value Otherwise, one must use zip/each_with_index and will get an array returned, not just the value seeked: r = values.zip(some_array).bsearch{|val, other_val| val >= other_val} a_value = r.first
on 2013-01-22 10:49
on 2013-01-30 07:05
Issue #7725 has been updated by marcandre (Marc-Andre Lafortune). Status changed from Open to Closed Assignee set to marcandre (Marc-Andre Lafortune) Fixed with r38984. ---------------------------------------- Bug #7725: bsearch should return enumerator when called without a block https://bugs.ruby-lang.org/issues/7725#change-35718 Author: marcandre (Marc-Andre Lafortune) Status: Closed Priority: Normal Assignee: marcandre (Marc-Andre Lafortune) Category: core Target version: 2.0.0 ruby -v: r38825 bsearch should return enumerator when called without a block This would allow, for example values.bsearch.with_index{|val, index| val >= some_array[index]} # => a value Otherwise, one must use zip/each_with_index and will get an array returned, not just the value seeked: r = values.zip(some_array).bsearch{|val, other_val| val >= other_val} a_value = r.first
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.