🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #812

Re: Does It Unify?

#812
From: Chris Weyand
Date: Mon, 07 May 1990 19:54
27 lines
1257 bytes
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
Technical Details
Message-ID: <13473@csli.Stanford.EDU>
Path: arc1-ca.pugleaf.net!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
References: <1990May7.132305.15989@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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