yes with disjunction

From: A.M.L.Fowler <A.M.L.Fowler_at_kent.ac.uk>
Date: Wed 11 Jun 2003 10:31:08 AM GMT
Message-Id: <E19Q2sm-0003yc-00@myrtle.ukc.ac.uk>
Can you tell me if the following is a bug or normal ECLiPSe
behaviour (it seems unusual - I have included the Sicstus
behaviour too for comparison).

If I load the following code into Sicstus:

  male( X) :- boy( X) ; man( X).
  boy( timmy).
  man( reg).

and query about 'reg' and 'tim' being male, I get 'yes'
both times as expected:

  | ?- male( reg).
  yes
  | ?- male(timmy).
  yes

But this is what happens with ECLiPSe (note, blank lines
removed to save space):

  [eclipse 1]: male( reg).
  Yes (0.00s cpu)              % 'yes', as expected

  [eclipse 2]: male(timmy).
  More (0.00s cpu) ?           % *** no 'yes' is given ***
  [eclipse 3]: 

Typing ';' to the '?' prompt doesn't help as that that
just produces a 'no' (as it should because 'timmy' is not
a man).

This occurs whenever there is a disjunction - if it's the final
clause of the disjunction that provides the (positive) answer to 
the current query then the 'yes' is given.  If it's not the final
clause of the disjunction then the 'yes' is not given.  This is
ia bit confusing for students who expect to see a 'yes' when asking
a question which has a positive answer.  Could you tell me why this
happens?

Many thanks,
Aliy
Received on Wed Jun 11 12:28:45 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:24 PM GMT GMT