- List of Backups
- View the diff.
- View the diff current.
- View the source.
- Go to Guards.
- 1 (2004-02-01 (Sun) 13:13:23)
*2 (2004-02-02 (Mon) 12:52:33)*- 3 (2004-04-06 (Tue) 11:45:47)
- 4 (2004-04-21 (Wed) 13:48:35)
- 5 (2004-10-15 (Fri) 10:59:26)
- 6 (2004-10-22 (Fri) 09:52:20)
- 7 (2006-01-08 (Sun) 15:18:09)
- 8 (2006-03-14 (Tue) 14:33:50)
- 9 (2006-11-02 (Thu) 10:36:50)
- 10 (2006-11-02 (Thu) 10:36:50)
- 11 (2010-06-13 (Sun) 15:51:59)
- 12 (2015-05-17 (Sun) 20:34:13)
- 13 (2015-05-18 (Mon) 21:07:14)
- 14 (2017-03-02 (Thu) 03:32:49)
- 15 (2017-03-02 (Thu) 07:49:19)
- 16 (2019-04-29 (Mon) 10:31:19)
- 17 (2019-04-29 (Mon) 16:49:44)

The full syntax of a rule is: ( Head :- [Guard | ] Body )

Guard must be a multiset of type constraints of the form: &math(p(\$p_{1}, \ldots , \$p_{n}));. The same abbreviation scheme as defined for atoms applies to type constraints when a process context name $pi occurs exactly two times in the rule.

Type constraints put constraints on the shapes of processes with which the process contexts specified in the arguments can match. The type constraint name p specifies the content of the constraints.

For example, the following type constraints can be used in Guard:

- int($p) specifies that $p must be an integer atom.
- $p < $q specifies that $p and $q are integer atoms such that the value of $p is less than that of $q.
- $r = $p +. $q specifies that $p, $q, and $r are floating point number atoms such that the sum of the values of $p and $q is equal to the value of $r.

In reality, each type constraint name (such as int or <) has its own mode of usage that specifies which of its arguments are input arguments. The effect of the constraint specified by a type constraint is enabled only after the shapes of its input arguments are all determined.

A process context name $p constrained in Guard is said to be typed in that rule. As a syntactic sugar, typed process context names can be written as link names as follows:

( Res = gen(N) :- N > 0 | Res = [N|gen(N-1)] ), p(gen(10))

Currently, the following type constraints can be used in the gua rd.

'='(+Unary,-Unary) - equivalence '='(-Unary,+Unary) - equivalence '=='(+Unary,+Unary) - equivalence unary(+Unary) int(+Int) float(+Float) int(+Float,-Int) - cast float(+Int,-Float) - cast 345(-Int) - for every integer, not only with 345 '-3.14'(-Float) - for every floating, not only with -3.14 '<'(+Int,+Int) - integer comparison, as well as: > =< >= =:= =\= '+'(+Int,+Int,-Int) - integer operation, as well as: - * / mod '<.'(+Float,+Float) - floating comparison, as well as: >. =<. >=. =:=. =\=. '+.'(+Float,+Float,-Float) - floating operation, as well as: -. *. /.