[squeak-dev] IdentitySet>>collect:

Colin Putney colin at wiresong.com
Sat Nov 29 20:45:06 UTC 2014


On Sat, Nov 29, 2014 at 11:04 AM, Chris Muller <asqueaker at gmail.com> wrote:


> I've never regarded collect as a mapping function, only a
> transformation function.
>

Yeah, I agree. I think the important features of #collect: are that (a) the
result is the same type of collection as the original, and (b) the result
contains all the the objects returned from the block. If the semantics of
that particular collection lead to the result being a different size from
the original, that's fine. It's also fine if there's no implicit mapping
from the original to the result; if you need such a mapping, build a
Dictionary, or at least a collection of Associations, as Chris suggests.

Keeping it simple will make it easy to predict what the particular
behaviour of any #collect: implementation will be.

Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20141129/c48e2f51/attachment.htm


More information about the Squeak-dev mailing list