Re: [eclipse-clp-users] exporting variables outside for

From: Thorsten Winterer <thorsten_winterer_at_...126...>
Date: Thu, 08 Apr 2010 13:32:55 +0200
Am 08.04.2010 12:31, schrieb Bogdan Tanasa:
> (for(I, 1, NN), param(NG, RHO, YMSP) do 
> 		length(Z, I), 
> 		append(Z, _, YMSP), 
> 		checkRho(Z, RHO, NG)),
> writeln(NG)
> ..
>
> for each I the NG will take different values and would like to keep the
> last one but I receive the No answer.
>
> I assume the problem is when I = 2 because NG already has a value and will
> interact with the param. 
>   

yes.

> How can I solve the problem?
>   

(
    for(I, 1, NN),
    fromto(_, _, NG0, NG),
    param(RHO, YMSP)
do
    length(Z, I),
    append(Z, _, YMSP),
    checkRho(Z, RHO, NG0)
),
writeln(NG)
...

Using a different name for the variable inside the loop will help readability.


Cheers,
Thorsten
Received on Thu Apr 08 2010 - 11:33:26 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST