mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 18:33:58 +00:00
Estimated hours taken: 4 Branches: main Added a new library module, array2d.m, implementing 2d rectangular arrays. NEWS: Report the new addition. library/array2d.m: Added. library/library.m: Added import for array2d. compiler/modules.m: Added clause for array2d to mercury_std_library_module/1. tests/hard_coded/test_array2d.m: tests/hard_coded/test_array2d.exp: tests/hard_coded/Mmakefile: Test case added.
36 lines
941 B
Plaintext
36 lines
941 B
Plaintext
Empty =
|
|
[[]]
|
|
|
|
One =
|
|
[[1]]
|
|
One ^ elem(0, 0) = 1
|
|
|
|
Two =
|
|
[[1, 0]
|
|
[0, 2]]
|
|
Two ^ elem(0, 0) = 1
|
|
Two ^ elem(0, 1) = 0
|
|
Two ^ elem(1, 0) = 0
|
|
Two ^ elem(1, 1) = 2
|
|
|
|
Two_a =
|
|
[[1, 3]
|
|
[0, 2]]
|
|
|
|
Two_b =
|
|
[[1, 3]
|
|
[4, 2]]
|
|
|
|
Zeroes =
|
|
[[0, 0, 0]
|
|
[0, 0, 0]
|
|
[0, 0, 0]]
|
|
|
|
Empty ^ elem(0, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(-1, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(0, -1) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(-1, -1) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(3, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(0, 3) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|
|
Zeroes ^ elem(3, 3) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
|