Re: freeze/2 and nb_setarg/3 interaction

Michael Hendricks <[email protected]> Thu, 10 Apr 2014 08:54:17 -0600
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFHuXuaiC=1Sme6gnMeVoZKwLjOvWqJmck3=XBbmOPq61S+yzg@mail.gmail.com>
I spent the morning looking through pl-prims.c and pl-attvar.c to debug
this.  My untrained eye didn't see any obvious problems.   Jan, what's the
best way for me to debug something like this?

Thanks.


-- 
Michael


On Wed, Apr 9, 2014 at 8:58 AM, Michael Hendricks <[email protected]> wrote:

> freeze/2 and nb_setarg/3 seem not to work together.  Consider this example:
>
>
> correct :-
>     X=[_|_],
>     ( nb_setarg(1,X, a),
>       nb_setarg(2,X, [b,c]),
>       writeln(X),
>       fail
>     ; writeln(X)
>     ).
>
> broken :-
>     X=[H|T],
>     freeze(H,nb_setarg(1,X,H)),
>     freeze(T,nb_setarg(2,X,T)),
>     ( H = a,
>       T = [b,c],
>       writeln(X),
>       fail
>     ; writeln(X)
>     ).
>
>
> ?- correct.
> [a,b,c]
> [a,b,c]
> true.
>
> ?- broken.
> [a,b,c]
> [_G1009|_G1010]
> true.
>
> Is that expected behavior?
>
> --
> Michael
>
-------------- next part --------------
HTML attachment scrubbed and removed