mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
Add the predicate all_true_in_range/3 where
all_true_in_range(P, Low, High) <=>
list.all_true(P, Low .. High)
except that it avoids construction of the list 'Low..High'.
library/int.m:
Add the above predicate.
s/Lo to Hi/Low to High/ in the description of the predicate
nondet_int_in_range/3. We use the latter form when describing
the fold predicates above.
NEWS:
Announce the new predicate.
Adjust an existing entry.
tests/hard_coded/Mmakefile:
tests/hard_coded/int_range_ops.{m,exp}:
Test the new predicate and also test the predicate nondet_in_range/3
since none of the existing tests covered that.
9 lines
366 B
Plaintext
9 lines
366 B
Plaintext
solutions(nondet_int_in_range(1, 0)) = []
|
|
solutions(nondet_int_in_range(1, 1)) = [0, 1]
|
|
solutions(nondet_int_in_range(1, 10)) = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
|
all_true_in_range(int.even, 1, 0): true
|
|
all_true_in_range(int.even, 1, 1): false
|
|
all_true_in_range(int.odd, 1, 1): true
|
|
all_true_in_range(LessThan10, 1, 5): true
|
|
all_true_in_range(LessThan10, 8, 11): false
|