Go to the first, previous, next, last section, table of contents.


Defining operators

Version: 1.7#116 (2001/8/9, 17:56:37 CEST)

Version of last change: 1.7#106 (2001/5/28, 20:6:27 CEST)

Operators allow writting terms in a more clear way than the standard functional notation. Standard operators in Ciao are defined by this predicate (but note that the compiler itself defines more operators at compile time):

standard_ops :-
        op(1200,xfx,[:-]),
        op(1200,fx,[:-,?-]),
        op(1100,xfy,[;]),
        op(1050,xfy,[->]),
        op(1000,xfy,[',']),
        op(900,fy,[\+]),
        op(700,xfx,[=,\=,==,\==,@<,@>,@=<,@>=,=..,is,=:=,=\=,<,=<,>,>=]),
        op(550,xfx,[:]),
        op(500,yfx,[+,-,/\,\/,#]),
        op(500,fy,[++,--]),
        op(400,yfx,[*,/,//,rem,mod,<<,>>]),
        op(200,fy,[+,-,\]),
        op(200,xfx,[**]),
        op(200,xfy,[^]),
        op(25,fy,[^]).

Usage and interface (operators)

Documentation on exports (operators)

PREDICATE: op/3:

op(Precedence,Type,Name)

Declares the atom Name to be an operator of the stated Type and Precedence (0 =< Precedence =< 1200). Name may also be a list of atoms in which case all of them are declared to be operators. If Precedence is 0 then the operator properties of Name (if any) are cancelled. Note that, unlike in ISO-Prolog, it is allowed to define two operators with the same name, one infix and the other postfix.

PREDICATE: current_op/3:

current_op(Precedence,Type,Op)

The atom Op is currently an operator of type Type and precedence Precedence. Neither Op nor the other arguments need be instantiated at the time of the call; i.e., this predicate can be used to generate as well as to test.

PREDICATE: current_prefixop/3:

No further documentation available for this predicate.

PREDICATE: current_infixop/4:

No further documentation available for this predicate.

PREDICATE: current_postfixop/3:

No further documentation available for this predicate.


Go to the first, previous, next, last section, table of contents.