[squeak-dev] The Inbox: Collections-mt.832.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri May 10 12:52:59 UTC 2019

So, there are two questions:

1) Name it #take: or #any: or #slice:?
2) Signal an Error (or Notification) if there are not enough elements in the collection or just compensate (less elements or duplicate elements)?

Am 10.05.2019 11:45:59 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:

Le ven. 10 mai 2019 à 10:25, Marcel Taeumel <marcel.taeumel at hpi.de [mailto:marcel.taeumel at hpi.de]> a écrit :

I think that "first" in the name would not work for an arbitrary collection, which might not have any order at all. "copy" sounds too low-level.

Agree, we already have #first: for the Sequenceable kind...

I do like #slice:. The name #take: is inspired from libraries for other languages and database frameworks. Yet, #slice: might also be better for randomized sampling (if desired) than #take:.

Then, we have #anyOne. So, what about #some:? ... or #anySome:? :-D

Yes, that's what I thought when you posted; just #any:
But #take: is a good name

Am 10.05.2019 09:22:12 schrieb K K Subbu <kksubbu.ml at gmail.com [mailto:kksubbu.ml at gmail.com]>:
On 10/05/19 11:34 AM, Marcel Taeumel wrote:
> Hmmm...
> (Set withAll: (1 to: 11)) take: 4 "-> e.g. #(1 2 3 4)"
> (Set withAll: (1 to: 11)) size take: 4 "-> 330"

May I suggest using #slice: or #copyFirst: for collections?

slice: 10
copyFirst: 10

Regards .. Subbu

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

More information about the Squeak-dev mailing list