From moeller@ebi.ac.uk Thu May 31 13:58:53 2001
Received: from alpha1.ebi.ac.uk (alpha1.ebi.ac.uk [193.62.196.122])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f4VBwq317937
	for <prolog@swi.psy.uva.nl>; Thu, 31 May 2001 13:58:53 +0200 (MET DST)
Received: from kandor.ebi.ac.uk (IDENT:moeller@kandor.ebi.ac.uk [193.62.199.202])
	by alpha1.ebi.ac.uk (8.9.3/8.9.3) with ESMTP id MAA61542;
	Thu, 31 May 2001 12:58:49 +0100 (BST)
Date: Thu, 31 May 2001 12:58:49 +0100 (BST)
From: Steffen Moeller <moeller@ebi.ac.uk>
To: Partsakoulakis Ioannis <jpar@aegean.gr>
cc: "'prolog@swi.psy.uva.nl'" <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] constraining the variable domain
In-Reply-To: <81FBBA8C21B9D311A6E500508B6144AA1201AA@eupalinos.aegean.gr>
Message-ID: <Pine.LNX.4.30.0105311249190.9689-100000@kandor.ebi.ac.uk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


Hi, teach this to your SWI command line:

assert(b(X,Y):-X\==Y).
assert(c(1,1)).
assert(c(1,2)).
assert(a(X,Y):-(c(X,Y),b(X,Y))).

and give it a try

?- a(X,Y).
X = 1 Y = 2 ;
No
?-


I assume your problem was the ordering of b/2 and c/2 in the a/2 clause.
Since this is a programming language and not a constraint solver, the
order of clauses is important, just assume you'd write a backtracking
engine yourself.

Cheers,

Steffen

