Re: [eclipse-clp-users] var vs. free

From: Ulrich Scholz <wanderer_at_thispla.net>
Date: Tue, 25 Jan 2011 11:31:07 +0100
Dear Joachim,

thanks for pointing out the difference between var and free.  I'll try to
keep it in mind.

However, the code my example is based on seems to be a case of a valid use
of free/1: After the call, the first argument is a solver variable.  If
called with a free, unattributed variable, a new solver variable is created.
Otherwise, this step is skipped.

Best regards,

Ulrich


> Please don't get into the habit of using
> free/1 instead of var/1 --- read the explanation at
> http://eclipseclp.org/doc/bips/kernel/typetest/free-1.html

> > An example:
> > 
> > --- ttt.ecl ---
> > t2(T1, _T2) :-
> >     free(T1),
> >     !,
> >     writeln(a).
> > 
> > t2(_T1, T2) :-
> >     T2 \== [],
> >     writeln(b).
> > 
> > t2(_T1, []) :-
> >     writeln(c).
> > ----------------
> 
Received on Tue Jan 25 2011 - 10:31:21 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET