projog

3.90. arithmetic_function(X) - defines a predicate as an arithmetic function.

Allows the predicate defined by X to be used as an arithmetic function.

Examples

squared(X,Y) :- Y is X * X.

?- squared(3,X).
X = 9

yes

?- X is squared(3).

Cannot find arithmetic operator: squared/1

?- arithmetic_function(squared/1).

yes

?- X is squared(3).
X = 9

yes