eyeprolog 1.5.90 → 1.5.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/conformance-report.md +3 -3
- package/package.json +1 -1
- package/test/conformance/README.md +1 -1
- package/test/conformance/THIRD_PARTY.md +18 -8
- package/test/conformance/cases/iso/scryer_current_predicate_after_existence_error.pl +7 -0
- package/test/conformance/cases/iso/scryer_current_prolog_flag_shared_var.pl +6 -0
- package/test/conformance/cases/iso/scryer_op_name_type_error.pl +6 -0
- package/test/conformance/cases/iso/swipl_call_n_builds_control_construct.pl +8 -0
- package/test/conformance/cases/iso/swipl_catch_partial_unification_rethrow.pl +9 -0
- package/test/conformance/cases/iso/swipl_keysort_remaining_errors.pl +10 -0
- package/test/conformance/cases/iso/swipl_length_errors.pl +8 -0
- package/test/conformance/cases/iso/swipl_memberchk_binding_retention.pl +6 -0
- package/test/conformance/cases/iso/swipl_operator_table_self_named.pl +16 -0
- package/test/conformance/cases/iso/swipl_sort_partial_list_errors.pl +8 -0
- package/test/conformance/cases/iso/swipl_write_canonical_var_and_curly.pl +8 -0
- package/test/conformance/cases/iso/trealla_clause_enumeration_backtracking.pl +13 -0
- package/test/conformance/cases/iso/trealla_compare_standard_order.pl +8 -0
- package/test/conformance/cases/iso/trealla_copy_term_bound_list_tail.pl +6 -0
- package/test/conformance/cases/iso/trealla_curly_and_colon_syntax_equivalence.pl +10 -0
- package/test/conformance/cases/iso/trealla_curly_braces_as_predicate.pl +10 -0
- package/test/conformance/cases/iso/trealla_forall_arithmetic_facts.pl +10 -0
- package/test/conformance/cases/iso/trealla_functor_arg_partial_term.pl +18 -0
- package/test/conformance/cases/iso/trealla_ground_progressive_backtracking.pl +21 -0
- package/test/conformance/cases/iso/trealla_once_inside_findall_template.pl +12 -0
- package/test/conformance/cases/iso/trealla_variable_aliasing_across_calls.pl +9 -0
- package/test/conformance/cases/lists/swipl_aggregate_sum_count.pl +14 -0
- package/test/conformance/cases/lists/swipl_assoc_del_min_roundtrip.pl +27 -0
- package/test/conformance/cases/lists/swipl_assoc_is_assoc_malformed.pl +37 -0
- package/test/conformance/cases/lists/swipl_assoc_is_assoc_valid.pl +10 -0
- package/test/conformance/cases/lists/swipl_lists_foldl_empty.pl +15 -0
- package/test/conformance/cases/lists/swipl_lists_reverse_mode.pl +13 -0
- package/test/conformance/cases/lists/swipl_ordsets_intersection_difference.pl +13 -0
- package/test/conformance/cases/lists/swipl_ordsets_is_ordset.pl +21 -0
- package/test/conformance/cases/lists/swipl_ugraphs_top_sort.pl +8 -0
- package/test/conformance/errors/iso/swipl_operator_clash_syntax_error.pl +5 -0
- package/test/conformance/expected/iso/scryer_current_predicate_after_existence_error.pl +1 -0
- package/test/conformance/expected/iso/scryer_current_prolog_flag_shared_var.pl +1 -0
- package/test/conformance/expected/iso/scryer_op_name_type_error.pl +1 -0
- package/test/conformance/expected/iso/swipl_call_n_builds_control_construct.pl +1 -0
- package/test/conformance/expected/iso/swipl_catch_partial_unification_rethrow.pl +1 -0
- package/test/conformance/expected/iso/swipl_keysort_remaining_errors.pl +1 -0
- package/test/conformance/expected/iso/swipl_length_errors.pl +1 -0
- package/test/conformance/expected/iso/swipl_memberchk_binding_retention.pl +1 -0
- package/test/conformance/expected/iso/swipl_operator_table_self_named.pl +1 -0
- package/test/conformance/expected/iso/swipl_sort_partial_list_errors.pl +1 -0
- package/test/conformance/expected/iso/swipl_write_canonical_var_and_curly.pl +4 -0
- package/test/conformance/expected/iso/trealla_clause_enumeration_backtracking.pl +1 -0
- package/test/conformance/expected/iso/trealla_compare_standard_order.pl +1 -0
- package/test/conformance/expected/iso/trealla_copy_term_bound_list_tail.pl +1 -0
- package/test/conformance/expected/iso/trealla_curly_and_colon_syntax_equivalence.pl +1 -0
- package/test/conformance/expected/iso/trealla_curly_braces_as_predicate.pl +1 -0
- package/test/conformance/expected/iso/trealla_forall_arithmetic_facts.pl +1 -0
- package/test/conformance/expected/iso/trealla_functor_arg_partial_term.pl +2 -0
- package/test/conformance/expected/iso/trealla_ground_progressive_backtracking.pl +1 -0
- package/test/conformance/expected/iso/trealla_once_inside_findall_template.pl +1 -0
- package/test/conformance/expected/iso/trealla_variable_aliasing_across_calls.pl +1 -0
- package/test/conformance/expected/lists/swipl_aggregate_sum_count.pl +2 -0
- package/test/conformance/expected/lists/swipl_assoc_del_min_roundtrip.pl +3 -0
- package/test/conformance/expected/lists/swipl_assoc_is_assoc_malformed.pl +3 -0
- package/test/conformance/expected/lists/swipl_assoc_is_assoc_valid.pl +1 -0
- package/test/conformance/expected/lists/swipl_lists_foldl_empty.pl +2 -0
- package/test/conformance/expected/lists/swipl_lists_reverse_mode.pl +1 -0
- package/test/conformance/expected/lists/swipl_ordsets_intersection_difference.pl +1 -0
- package/test/conformance/expected/lists/swipl_ordsets_is_ordset.pl +2 -0
- package/test/conformance/expected/lists/swipl_ugraphs_top_sort.pl +1 -0
- package/test/conformance/expected-errors/iso/swipl_operator_clash_syntax_error.txt +1 -0
- package/the-art-of-eyeprolog.md +1 -1
package/conformance-report.md
CHANGED
|
@@ -24,8 +24,8 @@ bytes, avoiding a second live fetch and its race window.
|
|
|
24
24
|
| context | 11 | 0 | 0 | 0 | 11 |
|
|
25
25
|
| control | 15 | 0 | 0 | 0 | 15 |
|
|
26
26
|
| explicit-tabling | 6 | 0 | 0 | 0 | 6 |
|
|
27
|
-
| iso |
|
|
28
|
-
| lists |
|
|
27
|
+
| iso | 259 | 220 | 0 | 0 | 479 |
|
|
28
|
+
| lists | 61 | 3 | 0 | 0 | 64 |
|
|
29
29
|
| modules | 2 | 0 | 0 | 0 | 2 |
|
|
30
30
|
| negation | 8 | 0 | 19 | 0 | 27 |
|
|
31
31
|
| proofs | 0 | 0 | 0 | 21 | 21 |
|
|
@@ -37,7 +37,7 @@ bytes, avoiding a second live fetch and its race window.
|
|
|
37
37
|
| terms | 26 | 3 | 0 | 0 | 29 |
|
|
38
38
|
| unification | 18 | 0 | 0 | 0 | 18 |
|
|
39
39
|
| variables | 16 | 7 | 0 | 0 | 23 |
|
|
40
|
-
| **Total** | **
|
|
40
|
+
| **Total** | **590** | **275** | **19** | **21** | **905** |
|
|
41
41
|
|
|
42
42
|
## DCG conformance clarification
|
|
43
43
|
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@ Selected cases are adapted from the ISO and standard-core suites of Logtalk,
|
|
|
138
138
|
Scryer Prolog, Trealla Prolog, and SWI-Prolog. Their upstream identifiers and licenses
|
|
139
139
|
are recorded in [THIRD_PARTY.md](THIRD_PARTY.md).
|
|
140
140
|
|
|
141
|
-
The corpus has
|
|
141
|
+
The corpus has 479 cases in `iso/` and 905 file-based conformance cases in total. Of those, 11 cases in `stc/` are explicitly labelled working-draft review evidence rather than normative ISO claims. The strict-reader WG17 syntax matrix is discovered dynamically and executed live by the Neumerkel gate, the same as its other seven TU Wien sources; release/report checks separately verify the tracked `NEUMERKEL-LATEST.md`. The generated `conformance-report.md` records local corpus totals and links to that live evidence. Together with regression, documentation-sync, API, example, and book-example checks, `npm test` is the release gate.
|
|
142
142
|
|
|
143
143
|
## Updating expected output
|
|
144
144
|
|
|
@@ -102,14 +102,24 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
102
102
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
103
103
|
SOFTWARE.
|
|
104
104
|
|
|
105
|
-
## SWI-Prolog core tests
|
|
106
|
-
|
|
107
|
-
Selected standard-core operator
|
|
108
|
-
are adapted from
|
|
109
|
-
`tests/
|
|
110
|
-
[SWI-Prolog](https://github.com/SWI-Prolog/swipl-devel)
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
## SWI-Prolog core and library tests
|
|
106
|
+
|
|
107
|
+
Selected standard-core operator, finite-tree unification, arithmetic, sort,
|
|
108
|
+
list, exception, and syntax cases under `iso/` are adapted from files under
|
|
109
|
+
`tests/core_lang/` and `tests/core_text/` in
|
|
110
|
+
[SWI-Prolog](https://github.com/SWI-Prolog/swipl-devel) -- named
|
|
111
|
+
`tests/core/test_op.pl` and `tests/core/test_occurs_check.pl` in older
|
|
112
|
+
checkouts, before that directory was split. Each adapted file identifies its
|
|
113
|
+
upstream source file.
|
|
114
|
+
|
|
115
|
+
Selected standard-library cases under the topic directories (not `iso/`,
|
|
116
|
+
since these exercise EyeProlog's own bundled `src/lib/` modules rather than
|
|
117
|
+
ISO core semantics) are adapted from files under `tests/library/` in the same
|
|
118
|
+
project -- `test_lists.pl`, `test_ordsets.pl`, `test_assoc.pl`,
|
|
119
|
+
`test_aggregate.pl`, and `test_ugraphs.pl`. Each adapted file identifies its
|
|
120
|
+
upstream source file and the `library(...)` module it needs.
|
|
121
|
+
|
|
122
|
+
The cases were rewritten for EyeProlog's query and exact-output harness.
|
|
113
123
|
|
|
114
124
|
BSD 2-Clause License
|
|
115
125
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
% Adapted from Scryer Prolog tests-pl/issue3370_current_predicate_call.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: current_predicate_after_existence_error(X0)
|
|
4
|
+
|
|
5
|
+
current_predicate_after_existence_error(R) :-
|
|
6
|
+
catch(call(foo_undefined, 1), _, true),
|
|
7
|
+
( current_predicate(foo_undefined/1) -> R = defined ; R = not_defined ).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_lang/test_call.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: call_n_builds_control_construct(X0, X1, X2)
|
|
4
|
+
|
|
5
|
+
call_n_builds_control_construct(IfThenElse, Disj, Conj) :-
|
|
6
|
+
findall(X, call(;((true -> X = a)), X = b), IfThenElse),
|
|
7
|
+
findall(X, call(;(X = a), X = b), Disj),
|
|
8
|
+
findall(X, call(','(X = a), X = b), Conj).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_lang/test_call.pl (catch, partial_unification).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: catch_partial_unification_rethrow(X0)
|
|
4
|
+
|
|
5
|
+
t3_rethrow :- throw(f(_, 2)).
|
|
6
|
+
t2_rethrow(X) :- catch(t3_rethrow, f(2, 1), X = 2).
|
|
7
|
+
t1_rethrow(X) :- catch(t2_rethrow(X), f(1, 2), X = 1).
|
|
8
|
+
|
|
9
|
+
catch_partial_unification_rethrow(X) :- t1_rethrow(X).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_lang/test_sort.pl (keysort tests a, b, c;
|
|
2
|
+
% the pair-type case (d) is already covered by corrigenda_keysort_pair_type.pl).
|
|
3
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
4
|
+
%% goal: keysort_remaining_errors(X0, X1, X2)
|
|
5
|
+
|
|
6
|
+
keysort_remaining_errors(Open, Improper, ElementOpen) :-
|
|
7
|
+
catch(keysort([a-b, b-b, a-b | _], _), error(Open, _), true),
|
|
8
|
+
L = [a-b, b-b | a],
|
|
9
|
+
catch(keysort(L, _), error(Improper, _), true),
|
|
10
|
+
catch(keysort([a-b, _], _), error(ElementOpen, _), true).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_lang/test_bips.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: length_errors(X0, X1, X2)
|
|
4
|
+
|
|
5
|
+
length_errors(NegLen, NonIntAtom, NonIntFloat) :-
|
|
6
|
+
catch(length(_, -2), error(NegLen, _), true),
|
|
7
|
+
catch(length(_, a), error(NonIntAtom, _), true),
|
|
8
|
+
catch(length(_, 0.1), error(NonIntFloat, _), true).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_text/test_syntax.pl (iso_op_table_6).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- op(100, fy, fy).
|
|
4
|
+
:- op(100, xfy, xfy).
|
|
5
|
+
:- op(100, yfx, yfx).
|
|
6
|
+
:- op(100, yf, yf).
|
|
7
|
+
|
|
8
|
+
%% goal: operator_table_self_named(X0, X1, X2, X3, X4, X5)
|
|
9
|
+
|
|
10
|
+
operator_table_self_named(R1, R2, R3, R4, R5, R6) :-
|
|
11
|
+
T1 = (fy fy 1), T1 == fy(fy(1)), R1 = T1,
|
|
12
|
+
T2 = (1 xfy 2 xfy 3), T2 == xfy(1, xfy(2, 3)), R2 = T2,
|
|
13
|
+
T3 = (1 xfy 2 yfx 3), T3 == xfy(1, yfx(2, 3)), R3 = T3,
|
|
14
|
+
T4 = (fy 2 yf), T4 == fy(yf(2)), R4 = T4,
|
|
15
|
+
T5 = (1 yf yf), T5 == yf(yf(1)), R5 = T5,
|
|
16
|
+
T6 = (1 yfx 2 yfx 3), T6 == yfx(yfx(1, 2), 3), R6 = T6.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_lang/test_sort.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: sort_partial_list_errors(X0, X1)
|
|
4
|
+
|
|
5
|
+
sort_partial_list_errors(Open, Improper) :-
|
|
6
|
+
catch(sort([a, b, a | _], _), error(Open, _), true),
|
|
7
|
+
L = [a, b | a],
|
|
8
|
+
catch(sort(L, _), error(Improper, _), true).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_text/test_write.pl (write_canonical tests).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: write_canonical_var_and_curly(ok)
|
|
4
|
+
|
|
5
|
+
write_canonical_var_and_curly(ok) :-
|
|
6
|
+
write_canonical('$VAR'(1)), nl,
|
|
7
|
+
write_canonical({a, b}), nl,
|
|
8
|
+
write_canonical(x(B, B)), nl.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0019.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: clause_enumeration_backtracking(X0)
|
|
4
|
+
|
|
5
|
+
populate_x24c :-
|
|
6
|
+
assertz(x24c(0)),
|
|
7
|
+
assertz(x24c(1)),
|
|
8
|
+
assertz(x24c(2)),
|
|
9
|
+
assertz(x24c(3)).
|
|
10
|
+
|
|
11
|
+
clause_enumeration_backtracking(L) :-
|
|
12
|
+
populate_x24c,
|
|
13
|
+
findall(X - B, clause(x24c(X), B), L).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0073.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: curly_and_colon_syntax_equivalence(X0, X1, X2, X3, X4)
|
|
4
|
+
|
|
5
|
+
curly_and_colon_syntax_equivalence(X, Y, Z, A, B) :-
|
|
6
|
+
X = {a:b},
|
|
7
|
+
Y = {}(a:b),
|
|
8
|
+
Z = :(a, b),
|
|
9
|
+
A = a:b,
|
|
10
|
+
B = (a:b).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0059.pl (test17).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: curly_braces_as_predicate(ok)
|
|
4
|
+
|
|
5
|
+
curly_braces_as_predicate(ok) :-
|
|
6
|
+
assertz({abc, 123}), assertz({xyz, 456}),
|
|
7
|
+
clause({abc, X}, B), X = 123, B = true,
|
|
8
|
+
clause({xyz, Y}, C), Y = 456, C = true,
|
|
9
|
+
{abc, Z}, Z = 123,
|
|
10
|
+
retract({xyz, W}), W = 456.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0032.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: forall_arithmetic_facts(ok)
|
|
4
|
+
|
|
5
|
+
eq32(3, 1 + 2).
|
|
6
|
+
eq32(24, 6 * 4).
|
|
7
|
+
eq32(1, 5 mod 2).
|
|
8
|
+
|
|
9
|
+
forall_arithmetic_facts(ok) :-
|
|
10
|
+
forall(eq32(Left, Right), Left =:= Right).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0059.pl (test1, test3).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: functor_arg_partial_term(ok)
|
|
4
|
+
|
|
5
|
+
functor_arg_partial_term(ok) :-
|
|
6
|
+
F = f(a, _, c),
|
|
7
|
+
functor(F, f, 3),
|
|
8
|
+
arg(2, F, b),
|
|
9
|
+
F = f(a, b, c).
|
|
10
|
+
|
|
11
|
+
%% goal: copy_term_then_reunify_propagates(ok)
|
|
12
|
+
|
|
13
|
+
copy_term_then_reunify_propagates(ok) :-
|
|
14
|
+
F = f(A, B, C),
|
|
15
|
+
copy_term(F, X),
|
|
16
|
+
F = X,
|
|
17
|
+
A = a, B = b, C = c,
|
|
18
|
+
arg(2, X, b).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0059.pl (test18).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: ground_progressive_backtracking(ok)
|
|
4
|
+
|
|
5
|
+
t18a2(X) :- X = f(a, b), fail.
|
|
6
|
+
t18a2(X) :- X = f(b, c), fail.
|
|
7
|
+
t18a2(X) :- X = f(_, world).
|
|
8
|
+
t18a(X) :- t18a2(X).
|
|
9
|
+
|
|
10
|
+
t18b2(X) :- X = f(e, f), fail.
|
|
11
|
+
t18b2(X) :- X = f(f, g), fail.
|
|
12
|
+
t18b2(X) :- X = f(hello, _).
|
|
13
|
+
t18b(X) :- t18b2(X).
|
|
14
|
+
|
|
15
|
+
ground_progressive_backtracking(ok) :-
|
|
16
|
+
X = f(_, _),
|
|
17
|
+
t18a(X),
|
|
18
|
+
\+ ground(X),
|
|
19
|
+
t18b(X),
|
|
20
|
+
ground(X),
|
|
21
|
+
X = f(hello, world).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0059.pl (test16c).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: once_inside_findall_template(X0)
|
|
4
|
+
|
|
5
|
+
age_once(peter, 7).
|
|
6
|
+
age_once(anne, 5).
|
|
7
|
+
age_once(pat, 8).
|
|
8
|
+
age_once(tom, 5).
|
|
9
|
+
|
|
10
|
+
once_inside_findall_template(L) :-
|
|
11
|
+
findall(X, once(age_once(X, _)), L),
|
|
12
|
+
ground(L), L = [peter].
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
% Adapted from Trealla Prolog tests/tests/test0059.pl (test14).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
%% goal: variable_aliasing_across_calls(ok)
|
|
4
|
+
|
|
5
|
+
bar_alias([A], B) :- A = B.
|
|
6
|
+
foo_alias(A, B) :- bar_alias(A, B).
|
|
7
|
+
|
|
8
|
+
variable_aliasing_across_calls(ok) :-
|
|
9
|
+
A = a, foo_alias([A], B), A = B.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_aggregate.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(aggregate)).
|
|
4
|
+
:- use_module(library(between)).
|
|
5
|
+
|
|
6
|
+
%% goal: aggregate_sum_template(X0)
|
|
7
|
+
|
|
8
|
+
aggregate_sum_template(Sum) :-
|
|
9
|
+
aggregate(sum(X), between(1, 2, X), Sum), !.
|
|
10
|
+
|
|
11
|
+
%% goal: aggregate_count_existential(X0)
|
|
12
|
+
|
|
13
|
+
aggregate_count_existential(Count) :-
|
|
14
|
+
aggregate(count, X ^ between(1, 2, X), Count), !.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_assoc.pl (random_min, del_empty,
|
|
2
|
+
% del_no_member; a fixed key list stands in for SWI's random/1-seeded one).
|
|
3
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
4
|
+
:- use_module(library(assoc)).
|
|
5
|
+
|
|
6
|
+
del_min_assoc_to_list(A, L) :- del_min_assoc_to_list(A, [], L).
|
|
7
|
+
del_min_assoc_to_list(t, L, L) :- !.
|
|
8
|
+
del_min_assoc_to_list(A, Rest, [Key - Val | Result]) :-
|
|
9
|
+
del_min_assoc(A, Key, Val, A1) -> is_assoc(A1), del_min_assoc_to_list(A1, Rest, Result).
|
|
10
|
+
|
|
11
|
+
%% goal: assoc_del_min_roundtrip(X0)
|
|
12
|
+
|
|
13
|
+
assoc_del_min_roundtrip(L) :-
|
|
14
|
+
list_to_assoc([5-e, 3-c, 8-h, 1-a, 4-d, 7-g, 2-b, 6-f, 10-j, 9-i, 11-k], A),
|
|
15
|
+
del_min_assoc_to_list(A, L), !.
|
|
16
|
+
|
|
17
|
+
%% goal: assoc_del_min_empty_fails(ok)
|
|
18
|
+
|
|
19
|
+
assoc_del_min_empty_fails(ok) :-
|
|
20
|
+
empty_assoc(A),
|
|
21
|
+
\+ del_min_assoc(A, _, _, _), !.
|
|
22
|
+
|
|
23
|
+
%% goal: assoc_del_min_no_member_fails(ok)
|
|
24
|
+
|
|
25
|
+
assoc_del_min_no_member_fails(ok) :-
|
|
26
|
+
list_to_assoc([1-a, 2-b, 4-c], A),
|
|
27
|
+
\+ del_min_assoc(3, A, _, _), !.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_assoc.pl (unbalanced_1/2/3,
|
|
2
|
+
% unordered_1/2/3, bad_structure_1/2, bad_structure_keys_not_ground).
|
|
3
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
4
|
+
:- use_module(library(assoc)).
|
|
5
|
+
|
|
6
|
+
%% goal: assoc_is_assoc_rejects_unbalanced(ok)
|
|
7
|
+
|
|
8
|
+
assoc_is_assoc_rejects_unbalanced(ok) :-
|
|
9
|
+
\+ is_assoc(t(5, 1, <, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
10
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
11
|
+
\+ is_assoc(t(5, 1, -, t(3, 1, -, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
12
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
13
|
+
\+ is_assoc(t(5, 1, -, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
14
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, >, t, t))))),
|
|
15
|
+
!.
|
|
16
|
+
|
|
17
|
+
%% goal: assoc_is_assoc_rejects_unordered(ok)
|
|
18
|
+
|
|
19
|
+
assoc_is_assoc_rejects_unordered(ok) :-
|
|
20
|
+
\+ is_assoc(t(5, 1, -, t(3, 1, <, t(2, 1, >, t, t(1, 1, -, t, t)), t(4, 1, -, t, t)),
|
|
21
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
22
|
+
\+ is_assoc(t(5, 1, -, t(4, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
23
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
24
|
+
\+ is_assoc(t(5, 1, -, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(6, 1, -, t, t)),
|
|
25
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
26
|
+
!.
|
|
27
|
+
|
|
28
|
+
%% goal: assoc_is_assoc_rejects_bad_structure(ok)
|
|
29
|
+
|
|
30
|
+
assoc_is_assoc_rejects_bad_structure(ok) :-
|
|
31
|
+
\+ is_assoc(t(5, 1, =, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
32
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
33
|
+
\+ is_assoc(t(5, 1, -, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
34
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, f, t))))),
|
|
35
|
+
\+ is_assoc(t(5, 1, -, t(3-_X, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
36
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
37
|
+
!.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_assoc.pl (wirth_85).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(assoc)).
|
|
4
|
+
|
|
5
|
+
%% goal: assoc_is_assoc_valid(ok)
|
|
6
|
+
|
|
7
|
+
assoc_is_assoc_valid(ok) :-
|
|
8
|
+
is_assoc(t(5, 1, -, t(3, 1, <, t(2, 1, <, t(1, 1, -, t, t), t), t(4, 1, -, t, t)),
|
|
9
|
+
t(8, 1, -, t(7, 1, <, t(6, 1, -, t, t), t), t(10, 1, -, t(9, 1, -, t, t), t(11, 1, -, t, t))))),
|
|
10
|
+
!.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_apply.pl (foldl empty tests).
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
5
|
+
false_foldl(_, _, _) :- fail.
|
|
6
|
+
|
|
7
|
+
%% goal: lists_foldl_empty_atom_starter(X0)
|
|
8
|
+
|
|
9
|
+
lists_foldl_empty_atom_starter(V) :-
|
|
10
|
+
foldl(false_foldl, [], foo, V), V == foo, !.
|
|
11
|
+
|
|
12
|
+
%% goal: lists_foldl_empty_unbound_starter(ok)
|
|
13
|
+
|
|
14
|
+
lists_foldl_empty_unbound_starter(ok) :-
|
|
15
|
+
foldl(false_foldl, [], VA, VB), VA == VB, !.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_lists.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
5
|
+
%% goal: lists_reverse_mode(X0)
|
|
6
|
+
|
|
7
|
+
% A trailing cut keeps this deterministic: nothing else stops the search
|
|
8
|
+
% for a second (nonexistent) solution once L's unique correct length is
|
|
9
|
+
% found, since nothing else bounds how long a next candidate open list
|
|
10
|
+
% could grow while still failing to match (see SWI's own "must be
|
|
11
|
+
% deterministic" comment on this test).
|
|
12
|
+
lists_reverse_mode(L) :-
|
|
13
|
+
reverse(L, [a, b]), L == [b, a], !.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_ordsets.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(ordsets)).
|
|
4
|
+
|
|
5
|
+
%% goal: ordsets_intersection_difference(X0, X1, X2, X3, X4)
|
|
6
|
+
|
|
7
|
+
ordsets_intersection_difference(R1, R2, R3, R4, R5) :-
|
|
8
|
+
ord_intersection([], [], X1, Y1), R1 = X1 - Y1,
|
|
9
|
+
ord_intersection([a, b, c], [b], X2, Y2), R2 = X2 - Y2,
|
|
10
|
+
ord_intersection([a], [a, b, c], X3, Y3), R3 = X3 - Y3,
|
|
11
|
+
ord_intersection([b], [a, b, c], X4, Y4), R4 = X4 - Y4,
|
|
12
|
+
ord_intersection([c], [a, b, c], X5, Y5), R5 = X5 - Y5,
|
|
13
|
+
!.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/library/test_ordsets.pl.
|
|
2
|
+
% See test/conformance/THIRD_PARTY.md.
|
|
3
|
+
:- use_module(library(ordsets)).
|
|
4
|
+
|
|
5
|
+
%% goal: ordsets_is_ordset_basic(ok)
|
|
6
|
+
|
|
7
|
+
ordsets_is_ordset_basic(ok) :-
|
|
8
|
+
is_ordset([a, b, c]), !.
|
|
9
|
+
|
|
10
|
+
% Genuinely interesting: is_ordset/1 must check standard order of terms
|
|
11
|
+
% rather than being implemented as a cheap sort(L,L) check -- that would
|
|
12
|
+
% wrongly succeed here, since X and Y are indistinguishable unbound
|
|
13
|
+
% variables at the point [Y,X] is checked.
|
|
14
|
+
%% goal: ordsets_is_ordset_unbound_pair(ok)
|
|
15
|
+
|
|
16
|
+
unbound_pair(_).
|
|
17
|
+
|
|
18
|
+
ordsets_is_ordset_unbound_pair(ok) :-
|
|
19
|
+
unbound_pair(T),
|
|
20
|
+
T = a(X, Y),
|
|
21
|
+
\+ is_ordset([Y, X]), !.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
% Adapted from SWI-Prolog tests/core_text/test_syntax.pl (op_3): `:-` is xfx
|
|
2
|
+
% (non-associative), so a chained `a:-b:-c` is a genuine operator-priority
|
|
3
|
+
% clash, not a parse of either association. See test/conformance/THIRD_PARTY.md.
|
|
4
|
+
%% goal: answer
|
|
5
|
+
answer :- X = (a:-b:-c).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
current_predicate_after_existence_error(not_defined).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
current_prolog_flag_shared_var(false).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
op_name_type_error(type_error(list, example(a, b))).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
call_n_builds_control_construct("a", "ab", []).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
catch_partial_unification_rethrow(1).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
keysort_remaining_errors(instantiation_error, type_error(list, [a - b, b - b | a]), instantiation_error).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
length_errors(domain_error(not_less_than_zero, -2), type_error(integer, a), type_error(integer, 0.1)).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
memberchk_binding_retention(y).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
operator_table_self_named(fy fy 1, 1 xfy 2 xfy 3, 1 xfy 2 yfx 3, fy 2 yf, 1 yf yf, 1 yfx 2 yfx 3).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sort_partial_list_errors(instantiation_error, type_error(list, "ab"||a)).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
clause_enumeration_backtracking([0 - true, 1 - true, 2 - true, 3 - true]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
compare_standard_order(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
copy_term_bound_list_tail([bb, cc]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
curly_and_colon_syntax_equivalence({a:b}, {a:b}, a:b, a:b, a:b).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
curly_braces_as_predicate(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
forall_arithmetic_facts(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ground_progressive_backtracking(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
once_inside_findall_template([peter]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
variable_aliasing_across_calls(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
assoc_is_assoc_valid(ok).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lists_reverse_mode("ba").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ordsets_intersection_difference([] - [], "b" - [], "a" - "bc", "b" - "ac", "c" - "ab").
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ugraphs_top_sort_linear([1, 2, 3]).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
parse line 5: non-associative operator :- requires parentheses
|
package/the-art-of-eyeprolog.md
CHANGED
|
@@ -10438,7 +10438,7 @@ must preserve the same observable outcome. Additional normal-mode syntax may
|
|
|
10438
10438
|
accept texts outside the strict grammar, but it may not reinterpret an accepted
|
|
10439
10439
|
standard case.
|
|
10440
10440
|
|
|
10441
|
-
The file-based conformance corpus contains
|
|
10441
|
+
The file-based conformance corpus contains 905 cases, including 479 focused ISO cases derived from the success, failure, mode, and error behavior in ISO/IEC 13211-1 clauses 7 and 8, Part 2 modules, and Part 3 grammar rules.
|
|
10442
10442
|
Separate exact-output suites check 229 normal examples and 61 proof examples; all executable chapter programs are parsed and their declared goals are executed. The nine-case
|
|
10443
10443
|
playground contract suite imports the production worker, sends real reasoning
|
|
10444
10444
|
requests through its message protocol, and crawls the served module graph for
|