Mercury Bugs - mercury
View Issue Details
0000236mercuryBugpublic2011-11-28 08:222011-11-28 10:39
Reportercolanderman 
Assigned To 
PrioritynormalSeveritytextReproducibilityN/A
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000236: Documentation for unsorted_aggregate incorrect (trivial)
Descriptionsolutions.unsorted_aggregate claims to be declaratively identical to calling list.foldl on the output of solutions.unsorted_solutions, when in fact it acts as if list.foldr is called. This is apparent from the definition of unsorted_solutions in solutions.m, which uses list.cons to build the solutions list (hence building it right-to-left).
TagsNo tags attached.
Attached Files

Notes
(0000413)
maclarty   
2011-11-28 09:28   
I don't think this is a bug, because declaratively the order of the solutions returned by unsorted_solutions is not defined (in fact all orders are valid in the declarative reading), so whether foldl or foldr is used for the declarative definition is irrelevant. It would be declaratively identical either way.
(0000414)
colanderman   
2011-11-28 10:39   
In practice, the order of solutions stays constant from run to run. It is useful while testing code to be able to replace unsorted_solutions with unsorted_aggregate (and v.v.) and obtain the same result. That this assumption is unreliable is sufficiently documented by the cc_multi determinism.

Changing "foldl" to "foldr" in the documentation is at least on some level "more correct", and is not from any perspective that I can think of less correct.

Issue History
2011-11-28 08:22colandermanNew Issue
2011-11-28 09:28maclartyNote Added: 0000413
2011-11-28 10:39colandermanNote Added: 0000414