<div dir="ltr"><div>Hi Patrick,</div><div><br></div><div>Would you be willing to employ the highest-level methods possible? "order do: [ .... ", creates an unnecessary dependency on the implementation when it appears #associationsDo: would work fine..?</div><div><br></div><div>It looks like it would put a space before the last paren. Picky, I know, but there is #do:separatedBy: to the rescue. I guess you could pre-allocate the OrderedDictionary to the proper size.</div><div><br></div><div>For the RunArray, could #runsAndValuesDo: help here? I'm having trouble following this code. At least in core code, #at:ifAbsentPut: should take a block for the second argument, IMO.</div><div><br></div><div>Best,</div><div> Chris</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 28, 2019 at 5:11 AM <<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Patrick Rein uploaded a new version of Collections to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-pre.838.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Collections-pre.838.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-pre.838<br>
Author: pre<br>
Time: 28 June 2019, 12:11:16.302033 pm<br>
UUID: db29f1b2-09b5-f045-aa21-9379185664df<br>
Ancestors: Collections-pre.837<br>
<br>
Two method additions to Collection. The first adds ordered printing to OrderedDictionaries, to allow users to actually see the ordering. The second adds a method to convert a run array into an expanded version of the runs.<br>
<br>
=============== Diff against Collections-pre.837 ===============<br>
<br>
Item was added:<br>
+ ----- Method: OrderedDictionary>>printElementsOn: (in category 'printing') -----<br>
+ printElementsOn: aStream <br>
+ "Based on Dictionary>>#printElementsOn:"<br>
+ <br>
+ aStream nextPut: $(.<br>
+ self size > 100<br>
+ ifTrue: [aStream nextPutAll: 'size '.<br>
+ self size printOn: aStream]<br>
+ ifFalse: [order do: [:assoc | assoc ifNotNil: [<br>
+ assoc printOn: aStream. aStream space]]].<br>
+ aStream nextPut: $)!<br>
<br>
Item was added:<br>
+ ----- Method: RunArray>>asValuesAndIntervals (in category 'converting') -----<br>
+ asValuesAndIntervals<br>
+ <br>
+ | interval result |<br>
+ result := OrderedDictionary new.<br>
+ 1 to: self size do: [:i |<br>
+ (self at: i) do: [:value |<br>
+ interval := result at: value ifAbsentPut: (i to: i).<br>
+ result at: value put: (interval start to: i)]].<br>
+ ^ result<br>
+ !<br>
<br><br></blockquote></div></div>