Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Matching numbers in database does not work in clause

Hi,
I am having trouble making the following code work:
outcome(_,Z1),
Z1~=X,
write('Z1 = '), write(Z1),nl,

where the call out to outcome() is expected to select the first database entry, then test for approximate equality with an instantiated variable, then do stuff. If it fails the Z1~= X, then it should backtrack to select the next entry. It fails the test every time, even though I know X has an equivalent entry in the database?

Can anyone help please? How sensitive is the ~= function?

Comments

  • What Prolog are you using? What does it say about ~=? Does it work in the listener? Say:
    ?- X = 14, Z1 = 14, Z1 ~= X.
    You can experiment with it like that.

    --Dennis
Sign In or Register to comment.