login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Submitted by : (unknown) at: 2007-11-17T22:29:01-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

the following commands:

fricas
(1) -> bb:=[1,1,2,2,2,2,1,1,1,3,1]

\label{eq1}\left[ 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 1, \: 1, \: 1, \: 3, \: 1 \right](1)
Type: List(PositiveInteger?)
fricas
sort! bb

\label{eq2}\left[ 1, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](2)
Type: List(PositiveInteger?)
fricas
bb

\label{eq3}\left[ 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](3)
Type: List(PositiveInteger?)

return:

  bb = [1,1,2,2,2,2,3]

is sort! only intended for lists without repetition?

fricas
bb:=[1,1,2,2,2,2,1,1,1,3,1]

\label{eq4}\left[ 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 1, \: 1, \: 1, \: 3, \: 1 \right](4)
Type: List(PositiveInteger?)
fricas
bb := sort! bb

\label{eq5}\left[ 1, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](5)
Type: List(PositiveInteger?)
fricas
bb

\label{eq6}\left[ 1, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](6)
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".

rather a documentation bug --kratt6, Sat, 10 Feb 2007 08:22:23 -0600 reply
Category: Axiom on Linux => Axiom Documentation Severity: serious => normal

why not work as documented? --billpage, Sun, 11 Feb 2007 14:48:24 -0600 reply
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?

Cleaning issues --Waldek, May 26, 2007 22:11:00 -0500 2007 reply
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




  Subject: (replying)   Be Bold !!
  ( 14 subscribers )  
Please rate this page: