What is the Prolog operator ^
?
Looking at The Prolog Built-in Directive op gives a list of the built-in operators.
I see
**
is exponentiation/\
is orbut what is ^
?
Each of the three current answers are of value and I learned something:
In Prolog, most symbols can be used 'uninterpreted', at syntactic level, in particular after an op/3
declaration, any atom can be used as operator. Then you can use, for instance, ^/2
as a function constructor for a domain specific language (a DSL), with a semantic specified from your rules.
Is SWI-Prolog (or more generally in ISO Prolog), current_op/3
gives you information about declared operators:
?- current_op(X,Y,^).
X = 200,
Y = xfy.
That said, any Prolog implementing setof/3
is expected to interpret ^/2
as a quantification specifier, when put to decorate the 2nd argument. As well, any Prolog implementing is/2
is expected to interpret ^/2
as exponentiation, when occurring on the right side of the is/2
expression.