File: test16.m

package info (click to toggle)
elpi 2.0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 50,296 kB
  • sloc: ml: 18,791; makefile: 229; python: 95; sh: 7
file content (26 lines) | stat: -rw-r--r-- 486 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
:- module test16.

:- interface.

:- import_module io.
:- pred main(io::di, io::uo) is det.

:- implementation.

:- pred p(int::in, int::out) is semidet.
:- pred f(int::out, int::out, int::out) is multi.

f(1,2,3).
f(2,3,1).
f(1,3,2).

p(4, Y) :- f(_Z,_X,_W), Y = 4.

% ERROR: this makes the predicate non-det:
% we may need to do backtracking in the body of p
p(5, 3) :- f(Z,X,T), f(X,Z,T).

main(!IO) :-
  io.write_line(10,!IO).

% clear && mmc ../tests/sources/functionality/test1.m