[comp.lang.prolog] Stupid Question about UNH Prolog

jax@well.UUCP (Jack J. Woehr) (10/30/88)

ok, forgive me for being stupid. In UNH Prolog, I consult the following:

/* cuttest.pro ... learning about the behaviour
   of the database and cuts.
*/

foo(1).
foo(2).
foo(3).

foobar(X,Y) :- foo(X),!,foo(Y).

	Then the query 

		?- foobar(X,Y).

	returns four answers;  (3,3) (3,1) (3,2) and (3,3)
in that order.

On the other hand, the file:

/* cuttest2.pro ... learning about the behaviour
   of the database and cuts.
*/

goobar(X,Y) :- goo(X),!,goo(Y).

goo(1).
goo(2).
goo(3).

	behaves as I expected the first one to do, returning three
answers: (1,1) (1,2) (1,3) to the query

	?- goobar(X,Y).

	Is UNH Prolog broken or am I?


{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{}									  {}
{} jax@well	." Sysop, Realtime Control and Forth Board"		  {}
{} jax@chariot  ." (303) 278-0364 300/1200 8-n-1 24 hrs."                 {}
{} JAX on GEnie		." Tell them JAX sent you!"			  {}
{}									  {}
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}

ok@quintus.uucp (Richard A. O'Keefe) (10/31/88)

In article <7505@well.UUCP> jax@well.UUCP (Jack J. Woehr) reports that
>foo(1).  foo(2).  foo(3).  foobar(X,Y) :- foo(X), !, foo(Y).
yields the answers (X,Y) = (3,3), (3,1), (3,2), (3,3), but that
>goobar(X,Y) :- goo(X), !, goo(Y).  goo(1).  goo(2).  goo(3).
yields the answers (X,Y) = (1,1), (1,2), (1,3) and asks
>	Is UNH Prolog broken or am I?

You should get the same answers from both.  However, the "foo" version
looks suspiciously as though there is an additional clause foo(3) at
the front.  Are you sure you tried this in an empty Prolog system?
If starting a fresh copy of Prolog, entering those clauses, and verifying
with the aid of listing/1 that those are the _only_ clauses for foo/1 and
foobaz/2 produces the result claimed, there is indeed a mistake.

jax@well.UUCP (Jack J. Woehr) (11/02/88)

In article <606@quintus.UUCP> ok@quintus.UUCP (Richard A. O'Keefe) writes:
>In article <7505@well.UUCP> jax@well.UUCP (Jack J. Woehr) reports that
>>foo(1).  foo(2).  foo(3).  foobar(X,Y) :- foo(X), !, foo(Y).
>yields the answers (X,Y) = (3,3), (3,1), (3,2), (3,3), but that
>>goobar(X,Y) :- goo(X), !, goo(Y).  goo(1).  goo(2).  goo(3).
>yields the answers (X,Y) = (1,1), (1,2), (1,3) and asks
>>	Is UNH Prolog broken or am I?
>
>You should get the same answers from both.  However, the "foo" version
>looks suspiciously as though there is an additional clause foo(3) at
>the front.  Are you sure you tried this in an empty Prolog system?
>If starting a fresh copy of Prolog, entering those clauses, and verifying
>with the aid of listing/1 that those are the _only_ clauses for foo/1 and
>foobaz/2 produces the result claimed, there is indeed a mistake.

	Richard, that was indeed the problem, and you would think that after
all these years of crashing the system right down to the EEROM system configs
using FORTH  I would have spotted it. UNH was right and jax was wrong.

	So now i hear from one of the many kind correspondents who
responded to my plight that there exists such a thing as the DEC-10
Prolog Library. What form is this thing in? Is it a book, a 9-track,
an 8" hard-sectored floppy, a mound of Holleriths? 

{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{}									  {}
{} jax@well	." Sysop, Realtime Control and Forth Board"		  {}
{} jax@chariot  ." (303) 278-0364 300/1200 8-n-1 24 hrs."                 {}
{} JAX on GEnie		." Tell them JAX sent you!"			  {}
{}									  {}
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}