[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vector compare

This page is part of the web mail archives of SRFI 67 from before July 7th, 2015. The new archives for SRFI 67 contain all messages, not just those from before July 7th, 2015.



Jens Axel Søgaard <jensaxel@xxxxxxxxxxxx> writes:

> As Sebastian argues, there not 1 natural order of vectors, but the
> ordering in the srfi is /a/ natural order. 

But, as Per and Donovan and myself are arguing, the one you picked
*isn't* a natural order, at least by our nature.

> A concrete
> example is the sorting of polynomials:
>
>      x^3 > x^2 + 1 > x^2 > 42
>
> A concrete representation in terms of vectors yields:
>
>   #(3 0 0 0) > #(2 0 1) > #(2 0 0) > #(42)

But it doesn't extend to leading 0 coefficients.

> In this scenerio the order used in the srfi is better
> efficiencywise than the lexicographical order -- and not
> only by a constant factor.

I'm personally gladly willing to pay that price.  I'd rather be slow
than surprised.

(And, of course, the efficiency argument only holds for one particular
implementation of vectors that isn't guaranteed by R5RS.)

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla