inconsistent definition of "sort" (and what about stability?)
Subject: inconsistent definition of "sort" (and what about stability?)
From: Stavros Macrakis
Date: Sun, 20 Nov 2011 16:56:46 -0500
On Sat, Nov 19, 2011 at 22:37, Steve Haflich <smh at franz.com> wrote:
> Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> If P(a,b) is not true or false for some a and b, sort signals an error.
>
> From where do you infer this behavior? It is _not_ something about
> cl:stable-sort guaranteed by the ANS (assuming the Maxima call to sort
> has not been rewitten to wrap the predicate to test for this).
>
Well, yes, Maxima sort doesn't simply call the underlying Lisp's sort.
What made you think it did?
> On the other hand, in ANSI CL there are no possible objects which are
> neither "true" nor "false", in the sense of "generalized boolean" which
> is what the sort predicate is required to return. Therefore the
> provision would be meaningless.
>
Maxima is not an implementation of ANSI CL (or any other Lisp), and does
not follow the Lisp convention that all non-NIL objects represent TRUE.
>
> On Sat, Nov 19, 2011 at 20:28, Oliver Kullmann <O.Kullmann at swansea.ac.uk>
> wrote:
>
> Predicate should return true if and only if the first argument is
> strictly less than the second (in some appropriate sense).
>
> (It's sloppy in the sense that "appropriate sense" it not defined.)
>
> "Appropriate sense" here means that sort predicate determines the
> desired ordering. That sense is opaque to and of no concern to sort
> itself.
>