mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
Estimated hours taken: 1 runtests: Compare actual outputs with the outputs computed by NU-Prolog. Mmake: Enable the dnf test. commit_bug.m: Use more readable formatting. environment.m: Since the expected output may be generated on a different machine than the one on which the test is run, don't print the value of a possibly machine-specific environment variable such as PATH. semidet_lambda.m: Fix the name of the module. univ.m: Add a couple of tests to exercise the typeinfo comparison routine. unreachable.m: Fix a comment. *.exp: The expected output files.
30 lines
549 B
Mathematica
30 lines
549 B
Mathematica
% This module tests the case of calling a semidet pred in
|
|
% a nondet lambda expression; Mercury-0.4 got this case wrong.
|
|
|
|
:- module semidet_lambda.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
:- import_module list, std_util.
|
|
|
|
main -->
|
|
{ q(Y) },
|
|
( { Y = [Z] } ->
|
|
io__write_int(Z),
|
|
io__write_string("\n")
|
|
;
|
|
io__write_string("Hello, world\n")
|
|
).
|
|
|
|
:- pred p(int::out) is semidet.
|
|
p(42).
|
|
|
|
:- pred q(list(int)::out) is det.
|
|
|
|
q(Y) :-
|
|
solutions(lambda([X::out] is nondet,p(X)), Y).
|
|
|