[eclipse-clp-users] Resume - permanent variables

From: Giuseppe Di Guglielmo <giuseppe.diguglielmo_at_...6...>
Date: Fri, 13 Feb 2009 14:14:29 +0100
Dear all,
please consider the following file:
---
% clp_utils.ecl

:- lib(ic).
:- lib(ic_search).

% integer type
% X is the identifier
% L is the left bound
% R is the right bound
integer_t(X,L,R) :- X :: L .. R.

constraint_1 :- integer_t(VAR1,0,127), (VAR1 #= 0).
---

I compile it in ECLiPSe and I execute the predicate 'constraint_1'. In the
following I'd like to look at the result in VAR1:

$ eclipse 
...
[eclipse 1]: [clp_utils].
...
clp_utils.ecl compiled 1504 bytes in 0.09 seconds

Yes (0.23s cpu)
[eclipse 2]: constraint_1.

Yes (0.00s cpu)
[eclipse 3]: writeln(VAR1).
VAR1

VAR1 = VAR1
Yes (0.00s cpu)

If I write the predicate as: 
constraint_2 :- integer_t(VAR1,0,127), (VAR1 #= 0), writeln(VAR1).

[eclipse 4]: constraint_2.
0

Yes (0.00s cpu)

The output is correct 0. 

How can I create "permanent variables" between each resume?

Regards,
Giuseppe
Received on Fri Feb 13 2009 - 13:14:42 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST