[vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Paul Baumann
((1 to: 10) asSortedCollection: [:a :b | a > b])
    groupedBy: [:ea | ea even ]
 
 Dictionary (true->SortedCollection (2 4 6 8 10) false->SortedCollection (1 3 5 7 9) )
Notice that the grouped items are no longer in the requested (a > b) sequence. Here is an example of the problem that this causes:
 
(((1 to: 10) collect: [:ea | ea asValue])
        asSortedCollection: [:a :b | a value > b value])
            groupedBy: [:ea | ea value even ]
A collection of domain objects that was sorted by attribute value raised MNU #<= when grouped.
 
Paul Baumann 
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Alan Knight-2
Hmmm. That's an interesting one. The groupedBy: operation does a self species withAll: for the sub-collections. That loses the sort block. We could do something like copyEmpty instead, but the problem is that that would break if you just used an interval. Perhaps intervals should implement copyEmpty to e.g. return an array? But there might be other cases as well, where self species ~= self class.

At 11:22 AM 1/26/2009, Paul Baumann wrote:
Content-Language: en-US
Content-Type: multipart/alternative;
         boundary="_000_CD50A3C7334E0F47B37D6244B310A02806497CBF29atbpixmx02CPE_"

((1 to: 10) asSortedCollection: [:a :b | a > b])
    groupedBy: [:ea | ea even ]
 
 Dictionary (true->SortedCollection (2 4 6 8 10) false->SortedCollection (1 3 5 7 9) )
Notice that the grouped items are no longer in the requested (a > b) sequence. Here is an example of the problem that this causes:
 
(((1 to: 10) collect: [:ea | ea asValue])
        asSortedCollection: [:a :b | a value > b value])
            groupedBy: [:ea | ea value even ]
A collection of domain objects that was sorted by attribute value raised MNU #<= when grouped.
 
Paul Baumann
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Paul Baumann
In reply to this post by Paul Baumann
Though not exactly expected, it seems acceptable to have SortedCollection>>groupedBy: return groups in OrderedCollection instances. The original sequence would be preserved and the re-sort costs would be avoided.
 
I've seen sortBlock carry issues in other contexts, but this one happened today and is easily demonstrated.
 
Thanks,
 
Paul Baumann 
 


From: Alan Knight [mailto:[hidden email]]
Sent: Monday, January 26, 2009 12:20 PM
To: Paul Baumann; VWNC
Subject: Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:
Importance: High

Hmmm. That's an interesting one. The groupedBy: operation does a self species withAll: for the sub-collections. That loses the sort block. We could do something like copyEmpty instead, but the problem is that that would break if you just used an interval. Perhaps intervals should implement copyEmpty to e.g. return an array? But there might be other cases as well, where self species ~= self class.

At 11:22 AM 1/26/2009, Paul Baumann wrote:
Content-Language: en-US
Content-Type: multipart/alternative;
         boundary="_000_CD50A3C7334E0F47B37D6244B310A02806497CBF29atbpixmx02CPE_"

((1 to: 10) asSortedCollection: [:a :b | a > b])
    groupedBy: [:ea | ea even ]
 
 Dictionary (true->SortedCollection (2 4 6 8 10) false->SortedCollection (1 3 5 7 9) )
Notice that the grouped items are no longer in the requested (a > b) sequence. Here is an example of the problem that this causes:
 
(((1 to: 10) collect: [:ea | ea asValue])
        asSortedCollection: [:a :b | a value > b value])
            groupedBy: [:ea | ea value even ]
A collection of domain objects that was sorted by attribute value raised MNU #<= when grouped.
 
Paul Baumann
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Andres Valloud-6
AR 58891.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Paul Baumann
Sent: Monday, January 26, 2009 10:19 AM
To: 'Alan Knight'; VWNC
Subject: Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:

Though not exactly expected, it seems acceptable to have SortedCollection>>groupedBy: return groups in OrderedCollection instances. The original sequence would be preserved and the re-sort costs would be avoided.
 
I've seen sortBlock carry issues in other contexts, but this one happened today and is easily demonstrated.
 
Thanks,
 
Paul Baumann 
 


From: Alan Knight [mailto:[hidden email]]
Sent: Monday, January 26, 2009 12:20 PM
To: Paul Baumann; VWNC
Subject: Re: [vwnc] [vw 7.5 bug] SortedCollection.sortBlock not carried forward by #groupedBy:
Importance: High

Hmmm. That's an interesting one. The groupedBy: operation does a self species withAll: for the sub-collections. That loses the sort block. We could do something like copyEmpty instead, but the problem is that that would break if you just used an interval. Perhaps intervals should implement copyEmpty to e.g. return an array? But there might be other cases as well, where self species ~= self class.

At 11:22 AM 1/26/2009, Paul Baumann wrote:
Content-Language: en-US
Content-Type: multipart/alternative;
         boundary="_000_CD50A3C7334E0F47B37D6244B310A02806497CBF29atbpixmx02CPE_"

((1 to: 10) asSortedCollection: [:a :b | a > b])
    groupedBy: [:ea | ea even ]
 
 Dictionary (true->SortedCollection (2 4 6 8 10) false->SortedCollection (1 3 5 7 9) )
Notice that the grouped items are no longer in the requested (a > b) sequence. Here is an example of the problem that this causes:
 
(((1 to: 10) collect: [:ea | ea asValue])
        asSortedCollection: [:a :b | a value > b value])
            groupedBy: [:ea | ea value even ]
A collection of domain objects that was sorted by attribute value raised MNU #<= when grouped.
 
Paul Baumann
 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

--
Alan Knight [|], Engineering Manager, Cincom Smalltalk


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc