"trigrat" caught in infinite loop - depending on how you call it



Well, it depends on what kind of equality you care about...

(setq *print-circle* t)
(setq xx (list 1 2)) (rplacd (last xx) xx)
(setq yy (list 1 2 1 2)) (rplacd (last yy) xx)

xx => #1=(1 2 . #1#)
yy => (1 2 1 2 . #1=(1 2 . #1#))

xx and yy are both (1 2 1 2 1 2 ...).

For that matter, xx and (rplacd xx xx) (same object at different times) are
the same in the 'eq' sense, but not the 'equal' sense.

          -s

On Wed, Nov 7, 2012 at 1:43 PM, Jean-Claude Arbaut <
jeanclaudearbaut at orange.fr> wrote:

>  I read your preceding answer a bit too fast :o)
>
> For circular structures, maybe this would help:
> http://rosettacode.org/wiki/Deepcopy#Common_Lisp
>
>
> Le 07/11/2012 19:35, Stavros Macrakis a ?crit :
>
> Well, it looks as though it's not an issue in the assume database,
> anyway....  All we need to do is wrap $trigrat with (let ((varlist)) ...).
>
>  As for comparing circular lists, yes of course you can write code to do
> the comparison, avoiding infinite recursion.  But it's more subtle than eq
> or equal.
>
>           -s
>
>  On Wed, Nov 7, 2012 at 1:22 PM, Jean-Claude Arbaut <
> jeanclaudearbaut at orange.fr> wrote:
>
>>  You're right, of course, but isn't there a way to check changes in
>> assume database ?
>> I didn't look its type in maxima sources, but it must be a lisp object
>> anyway.
>>
>> Le 07/11/2012 18:38, Stavros Macrakis a ?crit :
>>
>> State is stored in more places than just symbols' values.  One
>> possibility is something in the 'assume' database (which is stored in
>> symbols' plists and is a circular list structure that gets modified
>> in-place, so neither equal nor eq are good ways of comparing two
>> versions....
>>
>>              -s
>>
>>
>>
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>