[squeak-dev] The Trunk: Collections-ct.1012.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Jun 20 08:31:17 UTC 2022


Hi Christoph --

I think we should discuss this after the release and maybe move it to Inbox for now?

1. I don't think that #middle can be provided reasonably for an arbitrary SequenceableCollection. The +/- 1 index is probably surprising for the user.

2. Even #median on SortedCollection is not correct in the math domain. Shouldn't be the median of #(8 7 5 4 2 1) be 4.5 because there is an even number of elements? Hmm...

Hmm....

Best,
Marcel
Am 17.06.2022 22:43:14 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Christoph Thiede uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ct.1012.mcz

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

Name: Collections-ct.1012
Author: ct
Time: 17 June 2022, 10:41:55.471906 pm
UUID: bb97a774-226a-7f43-b69d-4dfc884a681f
Ancestors: Collections-lrnp.1011

Implements missing #middle on OrderedDictionary, just like we already have #first, #last, #ninth etc. there for compatibility with SequenceableCollection.

=============== Diff against Collections-lrnp.1011 ===============

Item was added:
+ ----- Method: OrderedDictionary>>middle (in category 'accessing') -----
+ middle
+ "Answer the middle element of the receiver."
+
+ ^ self atIndex: self size // 2 + 1!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220620/e6477040/attachment.html>


More information about the Squeak-dev mailing list