Cool. I integrated your suggestion.
Thanks, Doru On Tue, May 20, 2014 at 9:43 AM, Guillermo Polito <[email protected] > wrote: > But that does't work in the case the object you are looking for nil... > (Ok, maybe that's not a really relevant case...) > > This version however handles the case, > > detect: aBlock ifOne: presentBlock ifNone: noneBlock > | result | > result := self detect: aBlock ifNone: [ ^ noneBlock value ]. > ^ presentBlock value: result > > Guille > > > On Tue, May 20, 2014 at 9:38 AM, Stephan Eggermont <[email protected]>wrote: > >> detect: aBlock ifOne: presentBlock ifNone: noneBlock >> | result | >> result := self detect: aBlock ifNone: [nil]. >> ^ result isNil >> ifTrue: [ noneBlock value ] >> ifFalse: [ presentBlock value: result ] >> >> From CollectionExtensions in >> >> MCSmalltalkhubRepository >> owner: 'Moose' >> project: 'CollectionExtensions' >> user: '' >> password: '' >> > > -- www.tudorgirba.com "Every thing has its own flow"
