[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Counting Elements in Cyclic List

From: Mov GP 0
Subject: [Axiom-developer] Counting Elements in Cyclic List
Date: Mon, 1 Sep 2008 17:42:03 +0200

I'm new to axiom and tried to count the elements in a cyclic list and
expected to get %PositiveInfiniy as Answer. Instead it resulted in an
infinite loop. Version is Axiom 3.9 (September 2005)

What I've did:

u:= [9,2,4,7]; concat! (u, [1,2,42]); end := rest(u,4); part :=
rest(u,2);  setrest!(end, part);

u is now [9,2,(42,7,1)] -- the () are the cyclic part

when you count the elements using "#u" then it resolves in a loop.

What I 've expected:

There should be a Property like "isCyclic?" that tests if the list is
cyclic. The new code for counting should be something like

count(x) == if isCyclic? x then return ?PositiveInfinity else #x

Is this fixed already in a newer version?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]