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

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

 1 2 3 Editor: test1 Time: 2018/05/10 20:21:49 GMT+0 Note:

added:

From test1 Thu May 10 20:21:49 +0000 2018
From: test1
Date: Thu, 10 May 2018 20:21:49 +0000
Subject:
Message-ID: <20180510202149+0000@axiom-wiki.newsynthesis.org>

Status: open => closed



 Submitted by : (unknown) at: 2007-11-17T22:29:01-08:00 (14 years ago) Name : Axiom Version : default friCAS-20090114 Axiom-20050901 OpenAxiom-20091012 OpenAxiom-20110220 OpenAxiom-Release-141 Category : Axiom Aldor Interface Axiom Compiler Axiom Library Axiom Interpreter Axiom Documentation Axiom User Interface building Axiom from source lisp system MathAction Doyen CD Reduce Axiom on Windows Axiom on Linux Severity : critical serious normal minor wishlist Status : open closed rejected not reproducible fix proposed fixed somewhere duplicate need more info Optional subject :   Optional comment :

the following commands:

fricas
bb:=[1,1,2,2,2,2,1,1,1,3,1]
 (1)
Type: List(PositiveInteger?)
fricas
sort! bb
 (2)
Type: List(PositiveInteger?)
fricas
bb
 (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]
 (4)
Type: List(PositiveInteger?)
fricas
bb := sort! bb
 (5)
Type: List(PositiveInteger?)
fricas
bb
 (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