Bug/gotcha with Set>>collect:?
Mats Nygren
nygren at sics.se
Thu Jun 22 10:01:14 UTC 2000
Henrik Gedenryd <Henrik.Gedenryd at lucs.lu.se> wrote:
> I just encountered a real gotcha with Set>>collect, in that it returns its
> result in a Set as well. Imagine collecting eg. the sizes of a set of
> symbols. What you will get is in effect an occurrence set, since duplicates
> are removed.
> [snip]
> Henrik
Henrik and others,
Se my recent posting "reshape #collect: a little - from: [ENH]
on:collect:" and tell me/us what you think. I think it is a
proposal worth considering. Nobody responded to it. It needs
a double dispatch but with only rather few cases. Note also
that it is completely compatible with the present system.
I can work out the details and make a .cs if that is wanted.
In the present system the natural thing is:
aSet asArray collect: aBlock
But that calls for an intermediate structure that can be quite large,
its only use is that its species is Array and not Set.
/Mats
PS. I am still working with the functional squeak posting, a preliminary version will
be ready soon. DS.
More information about the Squeak-dev
mailing list
|