On Feb 20, 2007, at 8:55 PM, Daniel Villeneuve wrote:
> PART A: prototype for comparison functions
>
> The comparison function provided to list-sort and
> vector-sort should return a 3-way result when comparing two
> objects a and b:
> - negative integer: a < b
> - 0: a = b
> - positive integer: a > b
>
> This avoids comparing items twice, which can be costly in
> some cases (e.g., comparing vectors of numbers).
>
> There is evidence from other languages (C, Java) that the 3-way
> interface
> has advantages, which I presume involve performance as a criterion.
During other attempts to develop a standard interface for sort in
Scheme, reviewers have suggested a 3-way result for the comparison
function.
Please read:
http://srfi.schemers.org/srfi-32/mail-archive/msg00023.html
and
http://srfi.schemers.org/srfi-95/mail-archive/msg00002.html
(remembering that R^{5.92}RS requires a stable sort.)
-Felix
Received on Thu Feb 22 2007 - 02:05:37 UTC