2024-05-28 01:35 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000236mercuryBugpublic2011-11-28 10:39
Assigned To 
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




maclarty (developer)

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.


colanderman (reporter)

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
Date Modified Username Field Change
2011-11-28 08:22 colanderman New Issue
2011-11-28 09:28 maclarty Note Added: 0000413
2011-11-28 10:39 colanderman Note Added: 0000414
+Issue History