bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

call/2


From: stefano
Subject: call/2
Date: Fri, 27 Sep 2002 19:39:40 +0200

not sure if it's a bug or a feature:

call/2 seems to behave differently depending on the order of
the predicates in the database.  if there are predicates left
not matching the goal, but with the same functor, then call/2
never sets to true its second argument.

--- input file ----------------------------------------------
test(aa, a, 1).
test(aa, a, 2).
test(aa, a, 3).
test(aa, b, 1).
test(aa, b, 2).
test(aa, b, 3).

test_call_1 :- call(test(aa, a, X), Z), write(a: X), nl, Z = true.
test_call_2 :- call(test(aa, b, X), Z), write(b: X), nl, Z = true.
-------------------------------------------------------------

--- run -------------
| ?- test_call_1.
a:1
a:2
a:3

no
| ?- test_call_2.
b:1
b:2
b:3

yes
---------------------

note that this does not happen, i.e., you get a 'yes' with test_call_1
if you use test/2 predicates instead of test/3 ones (and modify
test_call_1 and test_call_2 accordingly...), like this:

        test(a, 1).
        test(a, 2).
        etc.

I mean, I had to put the 'aa' in order to trigger this (bug?).

I have not done further tests:  I'd rather first understand if it's
really a bug;  I am quite new to prolog.

regards,
stefano frabetti


--- info ----------------------------------------------------------
uname -a
Linux embeh.sif.it 2.4.18-SGI_XFS_1.1-2002-07-09 #7 Tue Jul 9 12:48:20 CEST 
2002 i686 unknown

gprolog --version
Prolog top-Level (GNU Prolog) 1.2.13
-------------------------------------------------------------------






reply via email to

[Prev in Thread] Current Thread [Next in Thread]