<nobu.nokada / softhome.net> schrieb im Newsbeitrag news:200401161401.i0GE1C2N006185 / sharui.nakada.kanuma.tochigi.jp... > Hi, > > At Fri, 16 Jan 2004 22:50:38 +0900, > Hal Fulton wrote: > > >>Would it make sense to allow #find to take an argument or a block > > >>(but not both)? > > > > > > > > > It conflicts current spec, which takes the value when nothing > > > found. You would need another name. > > > > I don't understand. Do you mean this has changed in 1.8? > > > > find traditionally has returned nil when it fails. > > Sorry, it was wrong a little. Enumerable#find calls the > optional parameter `ifnone' and returns its result, when no > object matches. In 1.6 or former, nil returned regardless of > the result. > > > Can you give me an example? > > $ ruby -e 'p [1,2,3].find(proc{puts "not found"; true}){|x|x.zero?}' > not found > true Apart from that, many cases of arr.find {|x| x==i} can be dealt with by arr.include?( i ) - at least those where one does not need the element returned but just the information whether it's there or not. But I guess, you asked because of the other cases... :-) Regards robert