Collection>>noneSatisfy:

Travis Griggs tgriggs at keyww.com
Fri Oct 26 20:36:25 UTC 2001


Paul Davidowitz wrote:

> Bug found in Collection>>noneSatisfy:
> See comment at end.
> 
> Collection>>
> noneSatisfy: aBlock
> 	"Evaluate aBlock with the elements of the receiver.
> 	If aBlock returns false for all elements return true.
> 	Otherwise return false"
> 
> 	self do: [:item | (aBlock value: item) ifTrue: [^ false]].
> 	^ false  "####### SHOULD BE true #######"



I would argue that this should have (in the first place) been implemented as:


noneSatisfy: aBlock
	^(self anySatisfy: aBlock) not



Once and only once. Less that could go wrong.

I dare someone to throw the "its faster argument" back at me.

-- 
Travis Griggs
Member: 3rd Boolean State Software Collective
Key Technology
"It had better be a pretty good meeting to be better than no meeting at 
all"-- Boyd K. Packer





More information about the Squeak-dev mailing list