File: test2.elpi

package info (click to toggle)
elpi 2.0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 50,296 kB
  • sloc: ml: 18,791; makefile: 229; python: 95; sh: 7
file content (16 lines) | stat: -rw-r--r-- 446 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
:functional 
pred p i:int, o:int.

:functional 
pred s o:int.

% THIS IS OK since a bang preclude distinct outputs 
p 1 3.
p 2 3 :- !.
          /* functional context: everything before the cut is irrelevant for functionality */
          /* moreover, we have parentheses around commas, i.e. a tree-like ast             */
p 2 A :- (r 3 A, q A, std.map [] std.rev []), (!, true).
p 2 X :- !, s X. /* X is a functional output of s */
p 2 5.

main.