root/tags/lgt290/library/metap.lgt

Revision 2, 1.2 KB (checked in by pmoura, 7 years ago)

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(metap).
3
4
5    :- info([
6        version is 2,
7        date is 2000/7/24,
8        authors is 'Paulo Moura',
9        comment is 'Useful meta-predicates protocol.']).
10
11
12    :- public(apply/2).
13
14    :- mode(apply(+callable, +list), zero_or_more).
15
16    :- info(apply/2, [
17        comment is 'Applies a predicate to list of arguments.',
18        argnames is ['Predicate', 'List']]).
19
20
21    :- public(callable/1).
22
23    :- mode(callable(@term), zero_or_one).
24
25    :- info(callable/1, [
26        comment is 'True if the argument can be called as a goal.',
27        argnames is ['Term']]).
28
29
30    :- public(filter/3).
31
32    :- mode(filter(+callable, +list, -list), one).
33
34    :- info(filter/3, [
35        comment is 'Returns a list of all list elements that satisfy a predicate using apply/2.',
36        argnames is ['Predicate', 'In', 'Out']]).
37
38
39    :- public(map/3).
40
41    :- mode(map(+callable, ?list, ?list), zero_or_more).
42
43    :- info(map/3, [
44        comment is 'Maps a predicate over a list of elements using apply/2.',
45        argnames is ['Predicate', 'In', 'Out']]).
46
47
48    :- public(succeeds/2).
49
50    :- mode(succeeds(+callable, +list), zero_or_more).
51
52    :- info(succeeds/2, [
53        comment is 'True if the predicate succeeds for each list element using apply/2.',
54        argnames is ['Predicate', 'List']]).
55
56
57:- end_protocol.
Note: See TracBrowser for help on using the browser.