"Bill Page" <[EMAIL PROTECTED]> writes:

> On Mon, Sep 1, 2008 at 12:44 PM, Alfredo Portes wrote:
> >
> > This looks like it is not working in OpenAxiom. It looks like I run into
> > an infinite loop.
> >
> > Thanks.
> >
> > On Mon, Sep 1, 2008 at 12:28 PM, Bill Page wrote:
> >
> >> (1) -> u:= [9,2,4,7]; concat! (u, [1,2,42]); end := rest(u,4); 
> >> part:=rest(u,2);  setrest!(end, part);
> > ...
> >> (3) -> #u
> >>
> >>   >> System error:
> >>
> >> LENGTH: A proper list must not be circular: #1=(9 2 . #2=(4 7 1 . #2#))
> >
> 
> I wonder if this message originates in the underlying Lisp system? I do not
> recognize the terminology "proper list". It seems like it might be some Lisp
> inferred type. In this example I was using FriCAS on Windows (compiled with
> clisp under cygwin).  Maybe the infinite loop actually occurs in GCL?

Yes, it's not caught under FriCAS/sbcl, too, where we also get an infinite
loop.  The responsible part is in ILIST, where we have

   #x                  == LENGTH(x)$Lisp

note that in URAGG 
(inherited via ListAggregate - StreamAggregate - UnaryRecursiveAggregate)
there is some checking.  However, it is not particularly robust, it seems to
me:

  #x ==
    for k in 0.. while not empty? x repeat
      k = cycleMax and cyclic? x => error "cyclic list"
      x := rest x
    k

(cyclic? is actually deterministic, so it is indeed sufficient to call it once
only.  The above is supposed to make # fast on lists with less than cycleMax
elements.)

I guess, we should not override this definition in ILIST.

I have no idea how clisp checks whether a list is cyclic. Maybe this thread is
helpful:

http://groups.google.at/group/comp.games.development.programming.algorithms/browse_thread/thread/e6498c4fbaf69739/96e00c6a77b26b65?hl=de&lnk=st&q=detect+circular+list#96e00c6a77b26b65

Martin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to