mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-06 16:08:32 +00:00
Branches: main Add a new function to the array module for creating a new array from a list in reverse order. Make the existing array.from_list/2 predicate more efficient. library/array.m: Add the function array.from_reverse_list/1. Since array.from_list immediately fills in the elements of a newly-created array with those of the lists, don't bother initialising the array elements when the array is allocated (except in debugging grades). Generalise ML_unsafe_new_aray so that it can be used for both the above. tests/general/array_test.m: tests/general/array_test.exp: Test the new function. Update syntax and formatting in this test case. NEWS: Announce the new function.
25 lines
612 B
Plaintext
25 lines
612 B
Plaintext
A0: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
AMax0: 9
|
|
AMin0: 0
|
|
ASize: 10
|
|
AMin1: 0
|
|
AMax1: 9
|
|
ABsearch: yes(3)
|
|
A1: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10]
|
|
A2: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10, 1000, 1000, 1000, 1000, 1000]
|
|
A3: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10]
|
|
A4: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
A5: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
A6: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
|
|
B0: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
BMax0: 9
|
|
BMin0: 0
|
|
BSize: 10
|
|
BMin1: 0
|
|
BMax1: 9
|
|
BBsearch: yes(3)
|
|
B1: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10]
|
|
B2: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10, 1000, 1000, 1000, 1000, 1000]
|
|
B3: [1, 2, 3, 4, 5, 6, 7, 8, 100, 10]
|
|
Results all match
|