From jan@swi.psy.uva.nl  Fri Sep 15 14:30:02 2000
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id OAA07404;
	Fri, 15 Sep 2000 14:30:02 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id OAA23398;
	Fri, 15 Sep 2000 14:30:19 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Nicos Angelopoulos <nangelop@csd.abdn.ac.uk>, prolog@swi.psy.uva.nl
Subject: Re: tree and _X
Date: Fri, 15 Sep 2000 14:24:25 +0200
X-Mailer: KMail [version 1.0.28]
Content-Type: text/plain
References: <Pine.SGI.4.21.0009151317110.233195-100000@kea.csd.abdn.ac.uk>
In-Reply-To: <Pine.SGI.4.21.0009151317110.233195-100000@kea.csd.abdn.ac.uk>
MIME-Version: 1.0
Message-Id: <00091514301908.17207@gollem>
Content-Transfer-Encoding: 8bit

On Fri, 15 Sep 2000, Nicos Angelopoulos wrote:
>On Fri, 15 Sep 2000, Waseem Besada wrote:

>> another question:
>> 
>> What is the difference between a variable wriiten as X and _X ?

>	_X is an anonymous variable which normaly is used to 
>	signal to the compiler that s/he shouldnt worry about the
>	fact that this variable appears only once in the current 
>	clause
>
>	for instance 
>
>isnogood( Z ) :-
>	isnosobad( X, Z ).
>
>	will (normaly) raise a warning when compiled/consulted
>	whereas if you replace X by _X the warning disappears 

Not completely true.  The only anonymous variable in Prolog is
the sole '_' character: even if multiple occur in the same term
(clause) they are not unified.  If multiple _Name variables occur
in a term they do unify:

1 ?- write(foo(_,_)).
foo(_G252, _G253)

Yes
2 ?- write(foo(_X,_X)).
foo(_G264, _G264)

The compiler indeed doesn't warn on singleton variables for
variables starting with an underscore.  As far as I'm aware
this behaviour conforms to the standard and standard practice.

	--- Jan

