Subject: Re: [SWIPL] Help with the definiton of operators.

From: Jan Wielemaker <[email-masked]>
Date: Mon, 21 May 2001 22:18:38 +0200

> Does anybody can explain me why I can't define the operator "@" as having
> precedence 950 in the code below?
> 
> ================================================
> Welcome to SWI-Prolog (Version 4.0.5)
> Copyright (c) 1990-2000 University of Amsterdam.
> Copy policy: GPL-2 (see www.gnu.org)
> 
> For help, use ?- help(Topic). or ?- apropos(Word).
> 
> ?- op(950, yfx, @).
> 
> Yes
> ?- current_op(P, T, @).
> 
> P = 100
> T = fx

Just try a bit harder:

1 ?- op(950, yfx, @).

Yes
2 ?- current_op(P, T, @).

P = 100
T = fx ;

P = 950
T = yfx ;

No
3 ?- 

I.e. something can be an infix and prefix operator at the same time.
@ref is used by XPCE.

	--- Jan

P.s.	Operators declared inside a module remain local to that module.
	You can define a public operator using ?- op(950, yfx, user:(@)).
	(This is not standard, but from what I understand of the ISO
	draft, operators will be local in the future).