Subject: Re: single quotes

From: Jan Wielemaker <[email-masked]>
Date: Mon, 25 Oct 1999 09:54:59 +0200

On Mon, 25 Oct 1999, [email-masked] wrote:
>I am using SWI-Prolog 3.2.8 for Windows.  According to Clocksin and
>Mellish (1987):
>
>	"If an atom is enclosed in single quotes "'", then the atom 
>	may have any characters in its name." p. 22.
>
>However, in the following statement for a finite state transducer:
>
>	arc(0,1,'-'/a).
>
>I get the following error message from SWI-Prolog:
>
>	[WARNING: (d:/pl/bin/test.pl:1)
>	        d:/pl/bin/test.pl:1: Syntax error: Operator expected]
>
>If I change '-' to a simple atom, then there is no problem.  If I change the
>arc statement to:
>
>	arc(0,1,a/'-').
>
>There there is no problem.  I do not find this problem with Sicstus Prolog.
>
>What is going on here?

- is an operator (prefix and infix) with higher priority than / and
thus cannot an argument of /.  Now, this is the basic rule.  I tried
this on Quintus, which gives a syntax-error too.  Both SWI and SICStus
are a bit more liberal and try to read non-ambiguous constructs without
warning.  Appearently this fails for this case in SWI-Prolog.

The ISO standard demands this term to be written as

	arc(0, 1, (-)/a)

which is also expressed by SICSTus:

	| ?- write(arc(0, 1, '-'/a)).
	arc(0,1,(-)/a)
	yes

	Regards --- Jan