Not satisfying the equality, but you can use polymorphism. Block >> , aBlock ^ BlockCompositor andAll: OrderedCollection with: self with: aBlock
BlockCompositor >> #, aBlock conditions add: aBlock. BlockCompositor >> value: anObject ^ conditions allSatisfy: [:e | e value: anObject ] I don't really like the name BlockCompositor, but can't think of a better name at the moment. You could also implement logic for #or: using #+ and: #anySatisfy: for example, but need to safeguard against mixing both conditions. On Mon, 14 Mar 2022 at 22:29, Hernán Morales Durand < hernan.mora...@gmail.com> wrote: > I think I saw a coding pattern a while ago that allows you to do the > following: > > cond1 , cond2 , cond3 , cond4 > > And providing a kind of folding selector condition #and: you would get: > > [ cond1 and: [ cond2 and: [ cond3 and: [ cond4 ] ] ] ]. > > for example: > > conditions := [ : each | each firstName = 'Boca' ] , > [ : each | each lastName = 'Baret' ] , > [ : each | each fullName = 'Virgasia' ]. > > such that the following assert is met: > > self assert: conditions equals: [ : each | each firstName = 'Boca' and: [ > each lastName = 'Baret' and: [ each fullName = 'Virgasia' ] ] ]. > > Any ideas or pointers? > > Cheers, > > Hernán > >