|View Issue Details [ Jump to Notes ]||[ Issue History ] [ Print ]|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000236||mercury||Bug||public||2011-11-28 08:22||2011-11-28 10:39|
|Target Version||Fixed in Version|
|Summary||0000236: Documentation for unsorted_aggregate incorrect (trivial)|
|Description||solutions.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).|
|Tags||No tags attached.|
|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.|
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.
|2011-11-28 08:22||colanderman||New Issue|
||Note Added: 0000413|
|2011-11-28 10:39||colanderman||Note Added: 0000414|