In some cases, the program has to test some conditions in order to select one of the alternative courses of action.
The exact way in which conditions can be written and tested depends on the programming language. As far as Refal Plus is concerned, we use the following terminology.
A path
Thus empty expressions and failures may be considered as corresponding to the well-known truth values "true" and "false", respectively.
It should be kept in mind, however, that the evaluation of a condition
Some of the library functions are specifically designed for testing conditions. Such
functions are referred to as predicates. In Refal Plus a predicate returns either an
empty expression (if its arguments satisfy the condition) or a failure (if the condition is
not satisfied). For example, the function
If a program defines a predicate function, the declaration of the function must have the form
Now we consider several ways of using and combining conditions.