[squeak-dev] The Trunk: Collections-topa.725.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Dec 5 19:58:34 UTC 2016

Tobias Pape uploaded a new version of Collections to project The Trunk:

==================== Summary ====================

Name: Collections-topa.725
Author: topa
Time: 5 December 2016, 8:58:22.49114 pm
UUID: d521fd18-86b5-42ce-8c74-475031b54934
Ancestors: Collections-eem.724

Fix a few comments

=============== Diff against Collections-eem.724 ===============

Item was changed:
  ----- Method: ArrayedCollection class>>with:with:with:with: (in category 'instance creation') -----
  with: firstObject with: secondObject with: thirdObject with: fourthObject 
+ 	"Answer a new instance of me, containing only the four arguments as
- 	"Answer a new instance of me, containing only the three arguments as
  	| newCollection |
  	newCollection := self new: 4.
  	newCollection at: 1 put: firstObject.
  	newCollection at: 2 put: secondObject.
  	newCollection at: 3 put: thirdObject.
  	newCollection at: 4 put: fourthObject.

Item was changed:
  ----- Method: SequenceableCollection>>combinationsAt:in:after:do: (in category 'private') -----
  combinationsAt: jj in: aCollection after: nn do: aBlock
  	"Choose k of N items and put in aCollection.  jj-1 already chosen.  Indexes of items are in numerical order, to avoid the same combo being used twice.  In this slot, we are allowed to use items in self indexed by nn+1 to self size.  nn is the index used for position jj-1."
+ 	"(1 to: 6) combinations: 3 atATimeDo: [:each | Transcript cr; show: each printString]"
- 	"(1 to: 6) combinationsSize: 3 do: [:each | Transcript cr; show: each printString]"
  nn+1 to: self size do: [:index | 
  		aCollection at: jj put: (self at: index).
  		jj = aCollection size 
  			ifTrue: [aBlock value: aCollection]
  			ifFalse: [self combinationsAt: jj + 1 in: aCollection after: index do: aBlock]].!

More information about the Squeak-dev mailing list