root/tags/lgt2310/library/termp.lgt

Revision 3507, 1.8 KB (checked in by pmoura, 21 months ago)

Added predicate variant/2 to the library object "term".

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(termp).
3
4    :- info([
5        version is 1.1,
6        author is 'Paulo Moura',
7        date is 2007/4/3,
8        comment is 'Prolog term utility predicates protocol.']).
9
10    :- public(depth/2).
11    :- mode(depth(@term, ?integer), zero_or_one).
12    :- info(depth/2, [
13        comment is 'True if the depth of Term is Depth. The depth of atomic terms is zero; the depth of a compound term is one plus the maximium depth of its sub-terms.',
14        argnames is ['Term', 'Depth']]).
15
16    :- public(ground/1).
17    :- mode(ground(@term), zero_or_one).
18    :- info(ground/1, [
19        comment is 'True if the argument is ground.',
20        argnames is ['Term']]).
21
22    :- public(new/1).
23    :- mode(new(-nonvar), zero_or_one).
24    :- info(new/1, [
25        comment is 'Creates a new term instance (if meaningful).',
26        argnames is ['Term']]).
27
28    :- public(occurs/2).
29    :- mode(occurs(@var, @term), zero_or_one).
30    :- info(occurs/2, [
31        comment is 'True if the variable occurs in the term.',
32        argnames is ['Variable', 'Term']]).
33
34    :- public(subsumes/2).
35    :- mode(subsumes(@term, @term), zero_or_one).
36    :- info(subsumes/2, [
37        comment is 'The first term subsumes the second term.',
38        argnames is ['General', 'Specific']]).
39
40    :- public(subterm/2).
41    :- mode(subterm(?term, +term), zero_or_more).
42    :- info(subterm/2, [
43        comment is 'The first term is a subterm of the second term.',
44        argnames is ['Subterm', 'Term']]).
45
46    :- public(valid/1).
47    :- mode(valid(@nonvar), zero_or_one).
48    :- info(valid/1, [
49        comment is 'Term is valid.',
50        argnames is ['Term']]).
51
52    :- public(variant/2).
53    :- mode(variant(@term, @term), zero_or_one).
54    :- info(variant/2, [
55        comment is 'Each term is a variant of the other (i.e. they are structurally equivalent).',
56        argnames is ['Term1', 'Term2']]).
57
58    :- public(vars/2).
59    :- mode(vars(@term, -list), one).
60    :- info(vars/2, [
61        comment is 'Returns a list of all term variables.',
62        argnames is ['Term', 'List']]).
63
64:- end_protocol.
Note: See TracBrowser for help on using the browser.