the following commands: fricas (1) -> bb:=[1,
Type: List(PositiveInteger?)
fricas sort! bb
Type: List(PositiveInteger?)
fricas bb
Type: List(PositiveInteger?)
return: bb = [1,1,2,2,2,2,3] is sort! only intended for lists without repetition? fricas bb:=[1,
Type: List(PositiveInteger?)
fricas bb := sort! bb
Type: List(PositiveInteger?)
fricas bb
Type: List(PositiveInteger?)
All ! functions destroy their arguement - this is as intended. destroy or modify? --oklhazi, Fri, 09 Feb 2007 02:11:40 -0600 reply Thanks for clarification.
The manual says that all ! functions modify their arguments and concluded that sort!
sorts the list "in place", as stated on p.716 of the Axiom book, i.e., leaving the argument in a sorted state.
I realize that "modify" does have different interpretations indeed, including "destroy".
Category: Axiom on Linux => Axiom Documentation
Severity: serious => normal
It seems to me that the original expectation of the user who
submitted this bug and the Axiom Book are both very reasonable.
What is the purpose of the modifications that sort! makes to
it's argument? To "sort in place" is very reasonable. Why not
return this sorted result in the argument as one would expect?
I have looked at older issues in Issue Tracker and it seems that
there are significant number of issues which are just users not
understanding what Axiom is doing and expecting different result.
For example 335 sort! drops list elements is just example of linked list. Something like: (1) -> bb := [3, 4, 1, 2] (1) [3,4,1,2] Type: List PositiveInteger (2) -> bs := sort! bb (2) [1,2,3,4] Type: List PositiveInteger (3) -> bb (3) [3,4] Type: List PositiveInteger (4) -> bs (4) [1,2,3,4] Type: List PositiveInteger (5) -> bb.1 := 7 (5) 7 Type: PositiveInteger (6) -> bs (6) [1,2,7,4] Type: List PositiveInteger (7) -> should be, or maybe already is in the tutorial, as an illustration that what was a first element of the list after reorganization may point inside. Severity: normal => minor Status: open => closed |