[squeak-dev] Review Request: Bag-explorer & RunArray-explorer

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Mon Feb 7 23:30:09 UTC 2022


Here are two tiny changesets for you to review, striving to improve the usability of explorers for sparse collection classes. :-)

Usage examples (explore them or see the screenshots):

    {10 at 10. 10 at 10. 20 at 20. 20 at 20. 20 at 20. 30 at 30. 30 at 30. 40 at 40} asBag.
    {10 at 10. 10 at 10. 20 at 20. 20 at 20. 20 at 20. 30 at 30. 30 at 30. 40 at 40} as: RunArray.

Here's a follow-up question: Do we also want to have a RunArrayInspector?

Best,
Christoph

=============== Summary (Bag-explorer.2.cs) ===============

Change Set:        Bag-explorer
Date:            8 February 2022
Author:            Christoph Thiede

This changeset provides a more compact representation of Bags in the ObjectExplorer.

=============== Diff ===============

Bag>>explorerContents {*Morphic-Explorer} · ct 2/8/2022 00:15
+ explorerContents
+ 
+     ^ self valuesAndCounts withKeysSortedSafely associations collect: [:assoc |
+         ObjectExplorerWrapper
+             with: assoc key
+             name: assoc value printString
+             model: self]


=============== Summary (RunArray-explorer.1.cs) ===============

Change Set:        RunArray-explorer
Date:            8 February 2022
Author:            Christoph Thiede

This changeset provides a more compact representation of RunArrays in the ObjectExplorer. It also adds a new enumeration selector, #intervalsAndValuesDo:.

=============== Diff ===============

RunArray>>explorerContents {*Morphic-Explorer} · ct 2/8/2022 00:09
+ explorerContents
+ 
+     ^ OrderedCollection new: self runs size streamContents: [:stream |
+         self intervalsAndValuesDo: [:interval :value |
+             stream nextPut: (ObjectExplorerWrapper
+                 with: value
+                 name: interval printString
+                 model: self)]]

RunArray>>intervalsAndValuesDo: {enumerating} · ct 2/8/2022 00:09
+ intervalsAndValuesDo: aBlock
+ 
+     | index |
+     index := 0.
+     runs with: values do: [:run :value |
+         aBlock
+             value: (index + 1 to: (index := index + run))
+             value: value].


---
Sent from Squeak Inbox Talk
["RunArray-explorer.1.cs"]
["RunArray-explorer.png"]
["Bag-explorer.png"]
["Bag-explorer.2.cs"]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220208/161feeb5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RunArray-explorer.1.cs
Type: application/octet-stream
Size: 1870 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220208/161feeb5/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RunArray-explorer.png
Type: application/octet-stream
Size: 14784 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220208/161feeb5/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bag-explorer.png
Type: application/octet-stream
Size: 12137 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220208/161feeb5/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bag-explorer.2.cs
Type: application/octet-stream
Size: 1030 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220208/161feeb5/attachment-0007.obj>


More information about the Squeak-dev mailing list