Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!uakari.primate.wisc.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!amelia!eos!shelby!csli!weyand From: weyand@csli.Stanford.EDU (Chris Weyand) Newsgroups: comp.lang.prolog Subject: Re: Does It Unify? Message-ID: <13473@csli.Stanford.EDU> Date: 7 May 90 19:54:11 GMT References: <1990May7.132305.15989@agate.berkeley.edu> Sender: weyand@csli.Stanford.EDU (Chris Weyand) Distribution: usa Organization: Center for the Study of Language and Information, Stanford U. Lines: 27 c60c-2ca@WEB.berkeley.edu (Andrew Choi) writes: >Hi Gurus. I have a simple question about unification... >Assume I have the following predicate defined: >equal(X, X). >Does the following unify? >?- equal(foo(Y), Y). >On my Prolog interpreter, it unifies but gives very strange >instantiation for Y. What should the "correct" answer be? This is like querying with: ?- Y = foo(Y). In which case what will be returned is a very long predicate with the following form: Y = foo(foo(foo(foo(foo(foo(... It's just a recursive definiition of Y that happens to be somewhat nasty. Sort of like setting the cdr of a list to the list itself. Chris Weyand weyand@csli.Stanford.edu