"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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel