Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!tank.news.pipex.net!pipex!dish.news.pipex.net!pipex!bt!btnet!news.compulink.co.uk!cix.compulink.co.uk!usenet
From: alanw@cix.compulink.co.uk ("Alan Westwood")
Subject: Re: Question on strange behaviour
Message-ID: <DDpLG9.426@cix.compulink.co.uk>
Organization: LPA Ltd
References: <4164k5$f8d@gap.cco.caltech.edu>
Date: Tue, 22 Aug 1995 11:04:57 GMT
X-News-Software: Ameol
Lines: 26

cilibrar@gluttony.ugcs.caltech.edu (Rudi Cilibrasi) writes:
> 4 ?- rplus(X,three,five).
> No
> But what about the fourth query?  How come
> it didn't answer "X = two"?  I've managed to make alternate definitions
> of the "rplus" predicate which do, in fact, manage to figure out 
> problems

Given that the second clause is:
> rplus(A,B,Result) :-
>         A \= zero,
>         rsucc(Adown, A),
>         rsucc(Resultdown, Result),
>         rplus(Adown,B,Resultdown).
> 
> 

To see why this fails try, on the command line:
?- X \= zero .

A \= B means A does not UNIFY with B, clearly if either A or B or both is
a variable this will fail.

Alan Westwood
alanw@cix.compulink.co.uk
LPA Ltd.
