[squeak-dev] The Trunk: Collections-klc.329.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 8 07:41:48 UTC 2010


Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-klc.329.mcz

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

Name: Collections-klc.329
Author: klc
Time: 7 March 2010, 6:51:24.486 pm
UUID: 0781052e-3725-47a4-abca-df8299e9bace
Ancestors: Collections-klc.328

Return both the minimum and maximum of the given collection in a single pass.

Better (certainly reads better) implementation from Randal Schwartz.

=============== Diff against Collections-ar.327 ===============

Item was added:
+ ----- Method: Collection>>minMax (in category 'math functions') -----
+ minMax
+ 	"Scans for minimum and maximum in one pass returning the results as a two-element array"
+ 	| min max |
+ 	min := max := self anyOne.
+ 	self do: [ :each |
+ 		min := min min: each.
+ 		max := max max: each ].
+ 	^ Array with: min with: max!




More information about the Squeak-dev mailing list