Subject: Re: operators

From: Lionel Ains <[email-masked]>
Date: Thu, 11 May 2000 14:25:03 GMT+1

> -------Message d'origine-------
> De : "Politini, Cohen" <[email-masked]>
> Date : 11/05/100 04:58:20
> 
> I want to declare an operator 'c', so I wrote
> 
> :-op(1000,yfx,c).
> 
> Then now I want to say that the 'c' in NcR represents 
something like
> 
> operator c = ((N+N) - R)*R.
> 
> Cansomeone help me ??

Then you should add to your program:

:- arithmetic_function(c/2).
c(N, R, Result):-
  Result is (((N + N) - R) * R).

(see chapter 3.28 of the SWI-Prolog manual for details).

And the ?- X is (10 c 45).
Should be interpreted correctly.
Note: ?- X is (10c45) won't work because Prolog will then 
read 10c45 as one atom.

Lionel

______________________________________________________
Boîte aux lettres - Caramail - http://www.caramail.com