File: AnsProlog.lp

package info (click to toggle)
cloc 2.06-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,064 kB
  • sloc: perl: 30,146; cpp: 1,219; python: 623; ansic: 334; asm: 267; makefile: 244; sh: 186; sql: 144; java: 136; ruby: 111; cs: 104; pascal: 52; lisp: 50; haskell: 35; f90: 35; cobol: 35; objc: 25; php: 22; javascript: 15; fortran: 9; ml: 8; xml: 7; tcl: 2
file content (49 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% ASP logic program for cloc tests.
% Demonstrates the use of different types of comments in .lp files.
%
% There should be:
% 18 lines of comments
% 12 lines of whitespace (one inside a multi-line comment)
% 19 lines of code
%
% There are 49 total lines.
%

% This is a single line comment
baz(X) :- bar(X).   % This counts as a line of code

    % This is a slightly more indented single line comment
foo(X) :- baz(X).   % This counts as a line of code as well.

bar(a).

% Here are some choice rules and cardinality rules.
1 { bar(b); bar(c); bar(d) } 3.
1 { garply(X) : foo(X) } 2.

allow(a).
allow(b).
allow(c).

% conditional rule
conditional(X) :-
     garply(X);
     foo(X) : allow(X).

weight(1) :- conditional(a).
weight(2) :- conditional(b).
weight(3) :- conditional(c).
weight(4) :- conditional(d).


%* This is a multi-line comment with one whitespace line in it
quux(X) :- foo(X).  % This shouldn't be counted as it is in a multi-line comment.
this is a line inside a comment

*%

#minimize {
    X@0: weight(X)
}.

#show garply/1.