Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!bradley From: bradley@cs.utexas.edu (Bradley L. Richards) Newsgroups: comp.lang.prolog Subject: Re: Does It Unify? Message-ID: <189@qt.cs.utexas.edu> Date: 8 May 90 19:32:03 GMT References: <1990May7.132305.15989@agate.berkeley.edu> Distribution: usa Organization: U. Texas CS Dept., Austin, Texas Lines: 17 In article <1990May7.132305.15989@agate.berkeley.edu> c60c-2ca@WEB.berkeley.edu (Andrew Choi) writes: >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? According to the proper definition for unification, these terms should not unify. However, for "efficiency" reasons, most Prolog implementations omit the "occurs" check (i.e. here Y appears in foo(Y)), and blindly unify these terms. This is, in fact, an error--and one worth fussing at the manufacturer of your Prolog about. Implementing the occurs check isn't really that costly.... Bradley