Dear all,
While developing some code, I made following extension of the Collection protocol:�
select: aBlock ifNoneTakeAsDefault: aDefaultValue
� �|result|
� �result := self select: aBlock.
� �(result isEmpty)
� � � ifTrue: [^self class with: aDefaultValue]
� � � ifFalse: [^result].
Maybe this could be added to the Pharo 1.1 Collection clazz? Or do we want to keep the interface of Collection as small as possible (which is also a good idea!).
Kind Regards,
Bart
--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
Gravitation is not responsible for people falling in love. - Albert Einstein