[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Axiom-developer] Counting Elements in Cyclic List

**From**: |
root |

**Subject**: |
Re: [Axiom-developer] Counting Elements in Cyclic List |

**Date**: |
Mon, 1 Sep 2008 16:27:18 -0400 |

>*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*
>
>*=======================================*
>*Question:*
>*Is this fixed already in a newer version?*
In the documentation it states:
"Note that using the "#" operator on a list with cycles
causes Axiom to enter an infinte loop"
See:
<http://axiom-developer.org/axiom-website/documentation.html>
in Volume 0: Axiom Jenks and Sutor p41
Tim