[comp.lang.prolog] On "Does it unify ?" and the WAM

raghutp@hubcap.clemson.edu (Raghu Toppur) (05/30/90)

	While on the subject of unification, and the creation of
	circular structures : with a clause such as "equal(X,X).",
	attempts to execute "equal(Y,foo(Y))." would result in
	Y being instantiated to foo(foo(...(Y)).

	However, what about "equal(foo(Y),Y)." in the context of
	the Warren Abstract Machine ? Y will remain unbound, I think,
	if the WAM instructions perform like they ought to.

	Is there a way to produce the `proper' incorrect result 
	during the normal operation of the WAM ?


	Raghu Toppur
	Department of Computer Science,
	Clemson University, 
	Clemson, SC 29631.
	e-mail : raghutp@hubcap.clemson.edu

aipdc@castle.ed.ac.uk (Paul D. Crowley) (05/30/90)

The below impressed me - I had expected it to hang.

Script started on Tue May 29 21:12:04 1990
% prolog

Edinburgh Prolog version 1.5.04 (12 September 1988)
AI Applications Institute,  University of Edinburgh.

| ?- consult(loop).
loop consulted:   188 bytes      0.08 seconds
yes

| ?- listing.
loopy(X) :-
        Y=[foo,Y],
        [X|_1]=Y .
yes

| ?- loopy(X).

     X=foo 
yes

| ?- halt.

Prolog terminated
% exit

script done on Tue May 29 21:12:35 1990

-- 
\/ o\ Paul Crowley aipdc@uk.ac.ed.castle
/\__/ "Trust me, I know what I'm doing" - Sledge Hammer