Johannes Grabmeier wrote:
>
> I found the following bug in the basis List domain:
>
> (121) -> li := [5,6,7,8,9]
>
> (121) [5,6,7,8,9]
> Type:
> List(PositiveInteger)
> (122) -> delete!(li,1)
>
> (122) [6,7,8,9]
> Type:
> List(PositiveInteger)
> (123) -> li
>
> (123) [5,6,7,8,9]
> Type:
> List(PositiveInteger)
This is not a bug -- list operations are supposed to behave
that way. Basically: you should use returned value and
consider original as unusable (mangled). If you know
how lists work you can predict what will happen with
original, in particular in some cases orginal will
contain result of operation.
Note: this affects _all_ destructive operations on
list. Arrays are different, you can count on side
effect on original.
BTW: There is now related question (and answer) in FAQ
at Axiom Wiki:
1. Why sort is dropping list elements?
Lists work differently than arrays. Array structure does not change,
only differenet elements get assigned to given position. Each list
node has link to next node. Destructive operations on lists may
assign new values to links and change list structure. In particular
new list may have different first node than old one. So after
destructive operation one should always use returned result, because
old list may look scrambled.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.