Subject: [SWIPL] Un-binding

From: Broudo Nissim <[email-masked]>
Date: Tue, 21 Aug 2001 14:56:10 -0400 (EDT)

I would like to call a predicate twice, each time one of the predicate's
arguments bound to different constants:

my_pred(constant_1, X)
my_pred(constant_2, X)

But when I bind the second time (with PL_unify_atom_chars), I cannot get
constant_2 to bind.

Here is my code:

char *constant_1 = "constant_1"
char *constant_2 = "constant_2"
term_t v         = PL_new_term_refs(2)
PL_unify_atom_chars(v, constant_1);
predicate_t pred = PL_predicate("my_pred", 2, NULL);
qid_t qid        = PL_open_query(NULL, PL_Q_NORMAL, pred, v);
PL_next_solution(qid);
PL_unify_atom_chars(v,constant_2);
PL_next_solution(qid);

The second solution is identical to the first, becuase the second
PL_unify_atom_chars cannot bind a constant to an already bound
variable.  Is there any way to "unbind" a variable ?

Any hints *at all* would be appreciated.  Please let me know if I am
over-looking something *obvious*.

Thanks !

Nissim Broudo