[squeak-dev] The Inbox: Kernel-ct.1266.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Sep 6 13:36:49 UTC 2019


Hmm... #timesCollect: seems strange. Especially since #timesRepeat: does not provide the iteration number to the block. Then, #to:collect: has a similar problem: "from x to y collect what?" The explicit from "(x to: y)" for the interval object seems more readable.

-1  ;-)

Best,
Marcel
Am 06.09.2019 13:16:54 schrieb commits at source.squeak.org <commits at source.squeak.org>:
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-ct.1266.mcz

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

Name: Kernel-ct.1266
Author: ct
Time: 6 September 2019, 1:16:39.325698 pm
UUID: a5b0464f-61cf-4749-9ad3-92e7d8c85341
Ancestors: Kernel-eem.1265

Add shorthands for interval collecting

There are enough senders of #timesRepeat: that manually fill a collection, same goes for #to:do:

=============== Diff against Kernel-eem.1265 ===============

Item was added:
+ ----- Method: Integer>>timesCollect: (in category 'enumerating') -----
+ timesCollect: aBlock
+
+ ^ (1 to: self) collect: [:i | aBlock value]!

Item was added:
+ ----- Method: Number>>to:collect: (in category 'intervals') -----
+ to: stop collect: aBlock
+ "Evaluate aBlock for each element of the interval (self to: stop by: 1) and return the results."
+
+ ^ (self to: stop) collect: aBlock!


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


More information about the Squeak-dev mailing list