On Sat, 16 Mar 2019 at 06:33, Tim Mackinnon <tim@testit.works> wrote:
> Hi - in my quest to understand the edgier details of Pharo (and Smalltalk) > - and driven by fresh thoughts of completing exercism exercises - I was > surprised to find that there is no #excludes: operation on collection to > mirror the #includes: operation? > > I was curious about this - its seems a strange omission? > > Of course I can inverse it with not, or do things a different way - but we > have ifTrue: mirrored with ifFalse, empty/notEmpty so am I missing > something? > > I wanted to write something like > > > aString detect: [:c | ($0 to: $1) excludes: c] ifFound: aBlock. (Evaluate > a block if the string isn’t all 0 and 1’s) > purely off the cuff, if you want the opposite logic what about... aString detect: [:c | (($0 to: $1) includes: c) not ] ifFound: aBlock. Of course I can write this as: > > (aString reject: [:c | c = $0 | c = $1)) ifNotEmpty: aBlock > cheers -ben