mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 12:53:47 +00:00
Estimated hours taken: 0.25 tests/valid: Add a test case to test quantification of lambda expressions, and using variables as goals (rather than using call/1 explicitly).
26 lines
511 B
Mathematica
26 lines
511 B
Mathematica
% Test quantification of local variables in lambda expressions.
|
|
% Also test use of variables as goals (without *explicitly* using call/1).
|
|
|
|
:- module lambda_quant.
|
|
:- interface.
|
|
:- import_module list, int.
|
|
|
|
:- pred test(pred).
|
|
:- mode test(out((pred) is semidet)) is nondet.
|
|
|
|
:- implementation.
|
|
|
|
:- pred t is semidet.
|
|
t.
|
|
|
|
:- pred f is semidet.
|
|
f :- fail.
|
|
|
|
test(t).
|
|
test(f).
|
|
test(G) :-
|
|
G1 = ((pred) is semidet :- X = 0, X \= 1),
|
|
G2 = ((pred) is det :- X = [], X \= [_|_]),
|
|
G = ((pred) is semidet :- G1, G2).
|
|
|