Anonymous | Login | 02-27-2021 21:23 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0006943 | [Squeak] Collections | minor | always | 02-21-08 21:18 | 02-06-11 23:48 | ||||
Reporter | nicolas cellier | View Status | public | ||||||
Assigned To | nicolas cellier | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.10 | ||||||
Summary | 0006943: Heap equality should be associative | ||||||||
Description |
"This example shows that equality is not associative" | anArray heap1 heap2 | anArray := #(1 2 3). heap1 := Heap withAll: (1 to: 3) sortBlock: [:a :b | a < b]. heap2 := Heap withAll: (1 to: 3) sortBlock: [:a :b | b > a]. self assert: (heap1 = anArray) & (heap2 = anArray) ==> (heap1 = heap2) |
||||||||
Additional Information |
Heaps do compare their sortBlock. They are more relax when comparing with their species. This does happen since their species is Array... http://lists.squeakfoundation.org/pipermail/squeak-dev/2000-March/011043.html [^] As noted by Klaus Witzel, why did species change? Correcting which bug? |
||||||||
Attached Files |
![]() ![]() |
||||||||
|
![]() |
|
(0011858 - 248 - 324 - 324 - 324 - 324 - 324) nicolas cellier 02-21-08 22:12 |
I'm loosing my maths, #= should be an equivalence relation, reflexive, self assert: (a = a), symmetric, self assert: (a = b) ==> (b = a), transitive, self assert: (a = b) & (b = c) ==> (a = c) Yes Transitive rather than Associative... |
(0013836 - 326 - 359 - 359 - 359 - 359 - 359) nicolas cellier 08-21-10 14:07 |
The fix makes Heap behave like a SortedCollection: 1) re-establish the Heap species -> Heap. 2) collect: does collect:as: Array because there is no guarantee the sortBlock works after transformation 3) select: use #copyEmpty strategy (like OrderedCollection) Beware of load order, a Heap is used in your morphic world... |
(0013837 - 117 - 123 - 453 - 453 - 453 - 453) nicolas cellier 08-21-10 15:47 |
http://source.squeak.org/trunk/Collections-nice.370.mcz [^] http://source.squeak.org/trunk/CollectionsTests-nice.170.mcz [^] |
Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
49 total queries executed. 35 unique queries executed. |