mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
29 lines
625 B
Mathematica
29 lines
625 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module nondet_lambda.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
% The compiler was incorrectly simplifying this to `F = bar' in the erlang
|
|
% grade.
|
|
F = (pred(X::out) is nondet :- bar(X)),
|
|
( if F(Y) then
|
|
io.write(Y, !IO),
|
|
io.write_string("\n", !IO)
|
|
else
|
|
true
|
|
).
|
|
|
|
:- pred bar(int).
|
|
:- mode bar(out) is det.
|
|
|
|
bar(42).
|