Christoph Thiede uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-ct.1035.mcz
==================== Summary ====================
Name: Collections-ct.1035 Author: ct Time: 20 May 2023, 5:16:35.545462 pm UUID: c36b5e22-b60e-7148-ba41-35c553fb023a Ancestors: Collections-ct.1034
Adds SequenceableCollection>>groupsCollect: (analogously to #groupsDo: and #pairsCollect:). Especially useful for tests.
=============== Diff against Collections-ct.1034 ===============
Item was added: + ----- Method: SequenceableCollection>>groupsCollect: (in category 'enumerating') ----- + groupsCollect: aBlock + "Evaluate aBlock with my elements taken n at a time, where n is the number of arguments of aBlock, and asnwer an Array with the results. Ignore any leftovers at the end." + + | index argumentArray results numArgs endIndex | + numArgs := aBlock numArgs. + numArgs + caseOf: { + [ 0 ] -> [ ^self error: 'At least one block argument expected.' ]. + [ 1 ] -> [ ^self collect: aBlock ]. + [ 2 ] -> [ ^self pairsCollect: aBlock ] } + otherwise: []. + argumentArray := Array new: numArgs. + results := (Array new: self size // numArgs) writeStream. + index := 1. + endIndex := self size - numArgs + 1. + [ index <= endIndex ] whileTrue: [ + argumentArray + replaceFrom: 1 + to: numArgs + with: self + startingAt: index. + results nextPut: (aBlock valueWithArguments: argumentArray). + index := index + numArgs ]. + ^ results contents!
packages@lists.squeakfoundation.org