Having imagined collection count: [:each | ...]
DO NOT IMPLEMENT IT!
Check to see if it already exists.
Hint:�� it DOES exists and has done since before Pharo.
So 'pangrams are fun but this isn''t one' count: [:each | each isVowel]
already answers 10.
Something that may help you a lot is to visit the Collection
class in the browser, and read every method in the 'enumerating'
category.�� (You will benefit from looking at the others too, but
we are staying focussed.)�� When you have done that, visit the
SequenceableCollection class, and read every method in its
'enumerating' category.
For example, you will certainly find #overlappingPairsDo:.
Given that, you can add
overlappingPairsAnySatisfy: testBlock
�� self overlappingPairsDo: [:x :y |
�� �� (testBlock value: x value: y) ifTrue: [^true]].
�� ^false
And now you can test for two adjacent equal elements using
�� aSequence oberlappingPairsAnySatisfy: [:x :y | x = y]