mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
Estimated hours taken: 16
Branches: main
Add and use the capability of building 234 trees directly.
library/tree234.m:
Add new predicates for converting sorted assoc lists (both ascending
and descending) directly to trees. These should be significantly more
efficient than the existing assoc_list_to_tree234 predicate, which
does not assume sortedness, and thus inserts each element individually.
The main source of the efficiency improvement is that we avoid the
creation of lots of intermediate trees.
Add some sanity check predicates in the part of the module that
is not included in the documentation.
library/map.m:
Add a new predicate for creating a map from a reverse sorted assoc
list.
Modify the existing predicate for creating a map from a sorted assoc
list to use the new predicate in tree234.m, which should be more
efficient.
Since the new implementation of this predicate doesn't allow
duplicates, modify map.old_merge, which cannot ensure the absence of
duplicates, to call the old general implementation (which is not
reliant on sortedness or duplicate-freedom) instead.
NEWS:
Mention the publically visible new predicates, and the change in
map.from_sorted_assoc_list.
compiler/code_info.m:
compiler/equiv_type.m:
compiler/intermod.m:
compiler/var_locn.m:
Use the new, faster predicates when possible.
compiler/hlds_goal.m:
compiler/instmap.m:
Give some variables better names.
tests/hard_coded/tree234_sorted_insert.{m,exp}:
New test case to check the new functionality.
tests/hard_coded/Mmakefile:
Enable the new test case.
2 lines
17 B
Plaintext
2 lines
17 B
Plaintext
all tests passed
|