root/trunk/library/loopp.lgt

Revision 4096, 3.5 KB (checked in by pmoura, 9 months ago)

Clarify fail conditions for the "loop" library object predicates.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(loopp).
3
4    :- info([
5        version is 1.2,
6        author is 'Paulo Moura',
7        date is 2008/2/16,
8        comment is 'Loop control constructs protocol.']).
9
10    :- public(whiledo/2).
11    :- meta_predicate(whiledo(::, ::)).
12    :- mode(whiledo(+callable, @callable), zero_or_one).
13    :- info(whiledo/2, [
14        comment is 'While Condition is true do Action.',
15        argnames is ['Condition', 'Action']]).
16
17    :- public(dowhile/2).
18    :- meta_predicate(dowhile(::, ::)).
19    :- mode(dowhile(+callable, @callable), zero_or_one).
20    :- info(dowhile/2, [
21        comment is 'Do Action while Condition is true.',
22        argnames is ['Action', 'Condition']]).
23
24    :- public(foreach/3).
25    :- meta_predicate(foreach(*, *, ::)).
26    :- mode(foreach(@var, +list(term), @callable), zero_or_one).
27    :- info(foreach/3, [
28        comment is 'For each element Element in List call Goal.',
29        argnames is ['Element', 'List', 'Goal']]).
30
31    :- public(forto/3).
32    :- meta_predicate(forto(*, *, ::)).
33    :- mode(forto(+number, +number, @callable), zero_or_one).
34    :- info(forto/3, [
35        comment is 'Call Goal counting up from First to Last. Increment is 1. For convenience and clarity, First and Last can be arithmetic expressions. This predicate fails iff the Goal fails.',
36        argnames is ['First', 'Last', 'Goal']]).
37
38    :- public(forto/4).
39    :- meta_predicate(forto(*, *, *, ::)).
40    :- mode(forto(@var, +number, +number, @callable), zero_or_one).
41    :- info(forto/4, [
42        comment is 'Call Goal counting up from First to Last and instantiating Count to each successive value. Increment is 1. For convenience and clarity, First and Last can be arithmetic expressions. This predicate fails iff the Goal fails.',
43        argnames is ['Count', 'First', 'Last', 'Goal']]).
44
45    :- public(forto/5).
46    :- meta_predicate(forto(*, *, *, *, ::)).
47    :- mode(forto(@var, +number, +number, +number, @callable), zero_or_one).
48    :- info(forto/5, [
49        comment is 'Call Goal counting up from First to Last and instantiating Count to each successive value. For convenience and clarity, First, Last, and Increment can be arithmetic expressions. The absolute value of Increment is used. This predicate fails iff the Goal fails.',
50        argnames is ['Count', 'First', 'Last', 'Increment', 'Goal']]).
51
52    :- public(fordownto/3).
53    :- meta_predicate(fordownto(*, *, ::)).
54    :- mode(fordownto(+number, +number, @callable), zero_or_one).
55    :- info(fordownto/3, [
56        comment is 'Call Goal counting down from First to Last. Decrement is 1. For convenience and clarity, First and Last can be arithmetic expressions. This predicate fails iff the Goal fails.',
57        argnames is ['First', 'Last', 'Goal']]).
58
59    :- public(fordownto/4).
60    :- meta_predicate(fordownto(*, *, *, ::)).
61    :- mode(fordownto(@var, +number, +number, @callable), zero_or_one).
62    :- info(fordownto/4, [
63        comment is 'Call Goal counting down from First to Last and instantiating Count to each successive value. Decrement is 1. For convenience and clarity, First and Last can be arithmetic expressions. This predicate fails iff the Goal fails.',
64        argnames is ['Count', 'First', 'Last', 'Goal']]).
65
66    :- public(fordownto/5).
67    :- meta_predicate(fordownto(*, *, *, *, ::)).
68    :- mode(fordownto(@var, +number, +number, +number, @callable), zero_or_one).
69    :- info(fordownto/5, [
70        comment is 'Call Goal counting down from First to Last and instantiating Count to each successive value. For convenience and clarity, First, Last, and Decrement can be arithmetic expressions. The absolute value of Decrement is used. This predicate fails iff the Goal fails.',
71        argnames is ['Count', 'First', 'Last', 'Decrement', 'Goal']]).
72
73:- end_protocol.
Note: See TracBrowser for help on using the browser.