Node:False and multiple values, Next:Iteration, Previous:Statement sequences, Up:Control structure
Normally, an expression evaluates to a single result. However, an expression may yield NO results. This is interpreted as "false." All other results are "true." This is similar to the Icon programming language Raising an exception is the same as yielding no results.
Operations that are consider "boolean" conventionally return the empty sequence to signify truth. (The rationale is that we don't constraints that are true to print anything.) (Contrast this to Lisp, where the empty list means false.)
An expression may also yield multiple values, perhaps
using the |
operator:
Q1> 3|4 3|4 Q2> print_readable:=1 Q3> (3>2)|5 []|5 Q3> (3<2)|5 5If the backtracking implementation of multiple values is used, multiple results are yielded on demand.
The implementation of multiple results is very liable to change.
The if-then-else construct has the folowing syntax:
Q4> if 3 > 4 => 5 || 6 6
Logic variables are also implemented.
The _
evaluates to a new unbound logic variable cell.
There is some preliminary support for logical constraints.