From nissim@math.ufl.edu Tue Aug 21 20:56:12 2001
Received: from fileserver.math.ufl.edu (fileserver.math.ufl.edu [128.227.168.128])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f7LIuCb10704
	for <prolog@swi.psy.uva.nl>; Tue, 21 Aug 2001 20:56:12 +0200 (MET DST)
Received: from oneida.math.ufl.edu (oneida.math.ufl.edu [128.227.168.148])
	by fileserver.math.ufl.edu (8.9.1a/8.9.1) with ESMTP id OAA10334
	for <prolog@swi.psy.uva.nl>; Tue, 21 Aug 2001 14:56:11 -0400 (EDT)
Received: from localhost (nissim@localhost)
	by oneida.math.ufl.edu (8.9.1a/8.9.1) with ESMTP id OAA00657
	for <prolog@swi.psy.uva.nl>; Tue, 21 Aug 2001 14:56:11 -0400 (EDT)
X-Authentication-Warning: oneida.math.ufl.edu: nissim owned process doing -bs
Date: Tue, 21 Aug 2001 14:56:10 -0400 (EDT)
From: Broudo  Nissim <nissim@math.ufl.edu>
To: SWI-Prolog mailing list <prolog@swi.psy.uva.nl>
Message-ID: <Pine.GSO.4.21.0108211430110.653-100000@oneida.math.ufl.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: [SWIPL] Un-binding


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



