logo       

Re: [FIX] SortedCollectionFix-sr: msg#00728

lang.smalltalk.squeak.general

Subject: Re: [FIX] SortedCollectionFix-sr

Richard A. O'Keefe wrote:
<...>

> While anyone's looking at SortedCollection, consider
>
> #(3 1 4 1 5 9 2 6 5 3 5) asSortedCollection reversed
> The result prints as
> a SortedCollection (9 6 5 5 5 4 3 3 2 1 1)
> but has sortBlock nil, so the order disagrees with the sortBlock.
> #reversed does make sense for SortedCollections; it ought to return
> a collection with the opposite comparison.
>
>

There may be a problem: if you apply >>reversed multiple times the opposite
comparison sortBlock becomes bigger and bigger, if the implementation just
inverts it by constructing a new one with sending #not to the old. There are
other implementations possible, though.

Greetings,

Stephan
--
Stephan Rudlof (sr@xxxxxxxxx)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise