Project

General

Profile

Actions

Bug #7725

closed

bsearch should return enumerator when called without a block

Added by marcandre (Marc-Andre Lafortune) about 11 years ago. Updated about 11 years ago.

Status:
Closed
Target version:
ruby -v:
r38825
Backport:
[ruby-core:51564]

Description

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

Updated by marcandre (Marc-Andre Lafortune) about 11 years ago

  • Status changed from Open to Closed
  • Assignee set to marcandre (Marc-Andre Lafortune)

Fixed with r38984.

Actions

Also available in: Atom PDF

Like0
Like0