From waseem@isk.kth.se  Fri Sep 15 12:18:42 2000
Received: from isett.isk.kth.se (root@isett.isk.kth.se [130.237.209.11])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id MAA28903
	for <prolog@swi.psy.uva.nl>; Fri, 15 Sep 2000 12:18:41 +0200 (MET DST)
Received: from waseempc1 (waseem-pc1.isk.kth.se [130.237.209.186])
	by isett.isk.kth.se (8.9.3/8.9.3) with SMTP
	id MAA08777 for <prolog@swi.psy.uva.nl>;
	Fri, 15 Sep 2000 12:18:56 +0200 (MET DST)
Message-ID: <003201c01eff$00819540$bad1ed82@isk.kth.se>
From: "Waseem Besada" <waseem@isk.kth.se>
To: "swi prolog mailing list" <prolog@swi.psy.uva.nl>
Subject: tree and _X
Date: Fri, 15 Sep 2000 12:23:33 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

What is wrong in this fragment of Prolog: ( Thinking in dictionary, that is
a map of pairs Key -> Value)

tree(Key, Value, Left, Right).
lookup(Key, tree(Key1, Value1, Left, Right), Value) :-
Key < Key1, lookup(Key, Left, Value).
lookup(Key, tree(Key1, Value1, Left, Right), Value) :-
Key > Key1, lookup(Key, Left, Value).

?- Dict=tree(1, ko, _C, tree(2,katt,_B,_A)), lookup(1,Dict,V),
lookup(2,Dict,W).

The answer is No while I should get (as I beleive):
V= ko, W=katt.

Why ?

another question:

What is the difference between a variable wriiten as X and _X ?

Regards,
Waseem




