From: Michael Edgar Date: 2011-07-18T09:23:40+09:00 Subject: [ruby-core:38150] Re: [Ruby 1.9 - Feature #4766] Range#bsearch On Jul 17, 2011, at 8:12 PM, Michael Edgar wrote: > # Returns the first-discovered elt for which the block yields true > def bsearch_find(&blk) > binary_matches(&blk).each do |elt| > return elt if blk.call(elt) > end > end Whoops, this is silly. It should be as follows: def bsearch_find(&blk) binary_matches(&blk).first end I rewrote the first two methods when I came up with the strawman binary_matches API, and forgot to rewrite the third. Michael Edgar adgar@carboni.ca http://carboni.ca/