inconsistent definition of "sort" (and what about stability?)
Subject: inconsistent definition of "sort" (and what about stability?)
From: Steve Haflich
Date: Sat, 12 Nov 2011 13:14:19 -0800
Oliver Kullmann <O.Kullmann at swansea.ac.uk> wrote:
while trying various Lisp's (not finished yet) a problem showed up which
we had for a long time, but could ignore, due to just using
one Lisp, namely what is the definition of "sort"?:
I assume, since you are asking the Maxima list, you are concerned about
some particular implementation that purports to be an implementation of
ANSI Common Lisp. But it isn't at all clear to what documentation your
message refers.
ANSI Common Lisp has a well-done specification that covers most of these
issues. It is available (in ugly pdf, and for a fee) from ANSI, but it
is also available in a slightly earlier version (essentially the files
that were submitted to ANSI, just before ANSI slapped their headers and
footers and copyrights on it -- they are identical in all technical
specifications) from various places like Franz and Lispworks. (The
latter is the well-known Hyperspec.)
Now, some of the popular "Common Lisp" implementations predate the final
ANS and don't purport entirely to conform, but for most language details
the ANS is the first place you should look. Thereafter, check the
implementation documentation to see if it deviates significantly.
The definition of ANSI CL sort and stable-sort are here:
http://www.franz.com/support/documentation/current/ansicl/dictentr/sortstab.htm
The definition of "purports" can be found starting here:
http://www.franz.com/support/documentation/current/ansicl/dictentr/features.htm
First it says ...
Your specific questions about sort are certainly reasonable questions,
but you should read the ANS requirements first, and then sEe whethere
this particular implementation deviates in any significant way. IMO,
Maxima should be written for the ANS specification except in the rare
cases where implementation details beoome significant. These cases
shuld be rare! Dependence on implementation details exposes Maxima to
future contusions when that implementation changes out from under it.