mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 10:53:40 +00:00
tests/declarative_debugger/*.m:
tests/exceptions/*.m:
tests/general/*.m:
tests/grade_subdirs/*.m:
tests/purity/*.m:
tests/submodules/*.m:
tests/typeclasses/*.m:
Update programming style.
tests/declarative_debugger/*.inp:
Update line numbers in breakpoint commands.
tests/declarative_debugger/*.exp:
Update expected line numbers.
tests/exceptions/Mercury.options:
tests/general/Mercury.options:
Disable some warnings that are irrelevant to the test.
70 lines
1.3 KiB
Mathematica
70 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module special_term_dep.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
% Term dependencies in the presence of calls to special predicates.
|
|
|
|
:- implementation.
|
|
:- import_module list.
|
|
|
|
main(!IO) :-
|
|
test1(!IO), % compare
|
|
test2(!IO). % unify
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- pred test1(io::di, io::uo) is det.
|
|
|
|
test1(!IO) :-
|
|
p(L),
|
|
io.write_line(L, !IO).
|
|
|
|
:- pred p(list(int)).
|
|
:- mode p(out) is det.
|
|
|
|
p(L) :-
|
|
pa(L0),
|
|
( if compare('>', L0, [1]) then
|
|
L = L0
|
|
else
|
|
L = []
|
|
).
|
|
|
|
:- pred pa(list(int)::out) is det.
|
|
|
|
pa([2, 3]).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- pred test2(io::di, io::uo) is det.
|
|
|
|
test2(!IO) :-
|
|
( if q([1, 2], L) then
|
|
io.write_line(L, !IO)
|
|
else
|
|
io.write_string("no\n", !IO)
|
|
).
|
|
|
|
:- pred q(list(int)::in, list(int)::out) is semidet.
|
|
|
|
q(A, B) :-
|
|
qa(A),
|
|
qb(A, B).
|
|
|
|
:- pred qa(list(int)::out) is det.
|
|
|
|
qa([1, 2]).
|
|
|
|
:- pred qb(list(int)::in, list(int)::out) is det.
|
|
|
|
qb(_, [3]).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|