On Wed, Sep 3, 2008 at 8:45 PM, Waldek Hebisch wrote:
>
> Martin Rubey wrote:
>>
>> Martin Rubey writes:
>>
>> > Maybe it would make sense to compare speed with the definition
>> > taken from URAGG.  Well, no, I think it's best to fix this and move
>> > ahead.  I add an issue on MathAction, so we can fix it.
>>
>> Sorry: NO, we should compare with the speed of LENGTH$Lisp.
>>
>
> Concerning speed: using byte-code interpreter like Clisp or
> CCL the main difference is if function is in kernel (AFAIK
> LENGTH in CCL was implemented by C code) or is byte-code
> coded.  When using real compiler on long list using
> "two pointers" method for checking adds about 50% more
> reads, so LIST-LENGTH is expected to take 150% time of
> non-checking  LENGTH. Tricks with delayed checking (like
> in URAGG) can significantly reduce this for short lists (probably
> to few percents overhead).  My gut feeling is that if we really
> want checking then cost is acceptable.
>

It seems to me important to recognize that a "List" in Axiom really
*is* a recursive aggregate and not necessarily a linear structure at
all. I.e.

   List(S) has ListAggregrate(S)

which is a subcategory of RecursiveAggregate (among others) and that a
RecursiveAggregate is actually a "model for a directed graph
containing values of type S". Given this generality it seems most
appropriate to me to define 'length' in an appropriately general
manner - even if this costs 50% more doing it the wrong way.

> OTOH looping on cyclic lists is just one of may ways
> of writing infinite loop.  Also, typical code only creates
> normal lists and cyclic list require care in other algoriths.
> So I am not sure if we really want this check -- it is
> probably more propaganda then real help.
>

In my opinion the Axiom library should not deliberately implement
unsafe operations on it's data structures. If the correct model of a
given situation is a linear aggregate such as Vector (where the
concept of length is well-defined) rather than a recursive aggregate,
there are good reasons to encourage the programmer to use such a
structure rather than being unnecessarily general.

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
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