Hi
I have run into an "issue" with GROrderedMultiMap and iteration. The block passed to it is evaluated for every mapping. given an GROrderedMultiMap GROrderedMultiMap new at: '1' add: 'first'; at: '2' add: 'second'; at: '1' add: 'third'; yourself #keysDo: will be evaluated with '1', '2' and '1' again. I didn't expect the last one. Is this the expected behavior? Cheers Philippe _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
Probably depends on what you want to do. Given that #keysDo: and
#valuesDo: is typically implemented in terms of #keysAndValuesDo: it kind of makes sense. Now I don't know if we depend on the current implementation of #keysDo: somewhere? Why not just use "keys asSet"? Lukas On 7 July 2011 21:01, Philippe Marschall <[hidden email]> wrote: > Hi > > I have run into an "issue" with GROrderedMultiMap and iteration. The > block passed to it is evaluated for every mapping. > > given an GROrderedMultiMap > > GROrderedMultiMap new > at: '1' add: 'first'; > at: '2' add: 'second'; > at: '1' add: 'third'; > yourself > > #keysDo: will be evaluated with '1', '2' and '1' again. I didn't > expect the last one. Is this the expected behavior? > > > Cheers > Philippe > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
My inclination is to say that it *doesn't* make sense more than it *does* make sense, but trying to have a multi-value keyed collection implement the dictionary protocol is bound to lead to some confusion...
On Fri, Jul 8, 2011 at 6:14 AM, Lukas Renggli <[hidden email]> wrote: Probably depends on what you want to do. Given that #keysDo: and _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
In reply to this post by Lukas Renggli
2011/7/8 Lukas Renggli <[hidden email]>:
> Probably depends on what you want to do. Given that #keysDo: and > #valuesDo: is typically implemented in terms of #keysAndValuesDo: it > kind of makes sense. > > Now I don't know if we depend on the current implementation of > #keysDo: somewhere? Why not just use "keys asSet"? That would work. What I actually really need is something like #keysAndAllValuesDo: which evaluates the block one for every unique key with all the values of this key as a collection. Cheers Philippe _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
Free forum by Nabble | Edit this page |