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

Edit detail for #335 sort! drops list elements revision 1 of 3

1 2 3
Editor:
Time: 2007/11/17 22:29:01 GMT-8
Note: Cleaning issues

changed:
-
the following commands:
\begin{axiom}
bb:=[1,1,2,2,2,2,1,1,1,3,1]
sort! bb
bb
\end{axiom}
return::

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

is sort! only intended for lists without repetition?

\begin{axiom}
bb:=[1,1,2,2,2,2,1,1,1,3,1]
bb := sort! bb
bb
\end{axiom}

All ! functions destroy their arguement - this is as intended.


From oklhazi Fri Feb 9 02:11:40 -0600 2007
From: oklhazi
Date: Fri, 09 Feb 2007 02:11:40 -0600
Subject: destroy or modify?
Message-ID: <20070209021140-0600@wiki.axiom-developer.org>

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".

From kratt6 Sat Feb 10 08:22:23 -0600 2007
From: kratt6
Date: Sat, 10 Feb 2007 08:22:23 -0600
Subject: rather a documentation bug
Message-ID: <20070210082223-0600@wiki.axiom-developer.org>

Category: Axiom on Linux => Axiom Documentation 
Severity: serious => normal 


From billpage Sun Feb 11 14:48:24 -0600 2007
From: billpage
Date: Sun, 11 Feb 2007 14:48:24 -0600
Subject: why not work as documented?
Message-ID: <20070211144824-0600@wiki.axiom-developer.org>

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?


From Waldek Sat May 26 22:11:00 -0500 2007
From: Waldek
Date: May 26, 2007 22:11:00 -0500 2007
Subject: Cleaning issues
Message-ID: <20050612121753-0500@page.axiom-developer.org>

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.


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:

axiom
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?)
axiom
sort! bb

\label{eq2}\left[ 1, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](2)
Type: List(PositiveInteger?)
axiom
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?

axiom
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?)
axiom
bb := sort! bb

\label{eq5}\left[ 1, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 2, \: 2, \: 3 \right](5)
Type: List(PositiveInteger?)
axiom
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.