AW: [squeak-dev] The Inbox: Collections-pre.679.mcz

Rein, Patrick Patrick.Rein at hpi.de
Sat Feb 27 15:36:40 UTC 2016


Oh! Cool. :)


Well then the only proposition I have is adding it to the abstract collection class as iterating over combinations is not specific to a sequenceable collection. Or am I missing something here?

________________________________
Von: squeak-dev-bounces at lists.squeakfoundation.org <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Gesendet: Freitag, 26. Februar 2016 19:31
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: Collections-pre.679.mcz

But this already exist, at least for SequenceableCollection, try:

(1 to: 4) combinations: 2 atATimeDo: [:e | Transcript cr; show: e printString]

2016-02-26 16:05 GMT+01:00 <commits at source.squeak.org<mailto:commits at source.squeak.org>>:
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-pre.679.mcz

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

Name: Collections-pre.679
Author: pre
Time: 26 February 2016, 4:04:56.205127 pm
UUID: 2ac5821c-d6f5-418c-ab07-ed3c2b9de62c
Ancestors: Collections-eem.678

This is a new iteration method which allows the iteration over asymmetric pairs. I have found this useful in game collision detections or duplicate detections. Alternatively we might want to take a second collection as input and create asymmetric pairs from self and this second collection.

=============== Diff against Collections-eem.678 ===============

Item was added:
+ ----- Method: Collection>>asymmetricPairsDo: (in category 'accessing') -----
+ asymmetricPairsDo: aBlock
+
+       | iterationCollection currentElement |
+       iterationCollection := self copy.
+
+       [currentElement := iterationCollection anyOne.
+       iterationCollection remove: currentElement.
+       iterationCollection isEmpty not]
+               whileTrue: [ iterationCollection
+                       do: [:element | aBlock value: currentElement value: element]].!



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160227/6ebbf9ba/attachment.htm


More information about the Squeak-dev mailing list