inconsistent definition of "sort" (and what about stability?)
Subject: inconsistent definition of "sort" (and what about stability?)
From: Oliver Kullmann
Date: Sun, 13 Nov 2011 19:17:04 +0000
> > (4) Use cl:stable-sort. (Perhaps that's what (1) is saying.)
>
> As part of the revised "sort" description, I recommend very strongly
> to say that "sort" is a stable sort. Incidentally, I am very strongly
> opposed to having another version of "sort" which is not a stable sort.
>
This seems very sensible to me:
- We actually assumed until now that sort would be stable, and use
this at quite a few places. Now with Ecl, CLisp and Sbcl, all our tests
pass, so that looks rather stable.
- The only advantage of unstable sort is some time- and memory-savings.
Now these savings are relatively small, and matter only for rather large
data sets. So it seems in the spirit of Maxima to do the stable thing.
- I guess if sort was used until now, then perhaps quite a few people
assumed stability at least intuitively. And fixing it as stable doesn't
seem to break anything (while allowing unstable sorts perhaps would).
Oliver