Predeclared in NON-DET

Functions

amb() → {value}

Given n values, creates a choice point whose value is chosen, at run-time, from the set e1, e2, ..., en.
If n is 0, it forces the language processor to backtrack to the most recent amb expression without returning a value.
Parameters:
Name Type Description
e1,e2,...en value given values
Returns:
a value from the given values chosen sequentially
Type
value

ambR() → {value}

Given n values, creates a choice point whose value is chosen, at run-time, randomly from the set e1, e2, ..., en.
If n is 0, it forces the language processor to backtrack to the most recent amb expression without returning a value.
Functions similarly to the amb operator but makes choices randomly instead of sequentially.
Parameters:
Name Type Description
e1,e2,...en value given values
Returns:
a value from the given values chosen randomly
Type
value

an_element_of(xs) → {value}

Nondeterministically returns an element from a given list.
Parameters:
Name Type Description
xs list given list
Returns:
- an element from xs
Type
value

an_integer_between(n, m) → {number}

Nondeterministically returns an integer between n and m (inclusively).
Parameters:
Name Type Description
n number lower bound
m number upper bound
Returns:
- a number between n and m (inclusive)
Type
number

bi_implication(P, Q) → {boolean}

Returns true if and only if P and Q satisfy the boolean equation P <--> Q.
Parameters:
Name Type Description
P boolean antecedent and consequent of the conditional
Q boolean antecedent and consequent of the conditional
Returns:
- a boolean according to the truth table of Material Biconditional
Type
boolean

cut()

Prevents the language processor from backtracking any further beyond the current statement.

implication(P, Q) → {boolean}

Returns true if and only if P and Q satisfy the boolean equation P --> Q.
Parameters:
Name Type Description
P boolean antecedent of the conditional
Q boolean consequent of the conditional
Returns:
- a boolean according to the truth table of Material Conditional
Type
boolean

require(pred) → {string}

Forces the language processor to backtrack to the most recent amb expression, if and only if pred evaluates to false.
Parameters:
Name Type Description
pred boolean given predicate
Returns:
- a message indicating that the given predicate is true
Type
string