mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
library/io.m:
Add predicates io.write_array/[56] which are are similar to
io.write_list but work on arrays and do _not_ require converting
the array into a list first.
library/array2d.m:
Add array2d.is_empty/1.
NEWS:
Announce the above additions.
tests/hard_coded/Mmakefile:
tests/hard_coded/write_array.{m,exp}:
Add a test for write_array.
tests/hard_coded/test_array2d.{m,exp}:
Extend this test to cover is_empty/1.
40 lines
991 B
Plaintext
40 lines
991 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
|
|
|
|
Empty is empty
|
|
One is not empty
|
|
Two is not empty
|
|
|
|
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")))
|