Email list hosting service & mailing list manager

there is no correct way to use list-sort! or list-stable-sort! William D Clinger (09 Mar 2016 12:31 UTC)
more corrections for SRFI 132 William D Clinger (10 Mar 2016 17:06 UTC)
Re: more corrections for SRFI 132 William D Clinger (10 Mar 2016 19:37 UTC)
Re: more corrections for SRFI 132 William D Clinger (10 Mar 2016 20:32 UTC)
benchmarking the SRFI 132 reference implementation William D Clinger (10 Mar 2016 23:20 UTC)
Re: more corrections for SRFI 132 William D Clinger (12 Mar 2016 03:07 UTC)
Re: more corrections for SRFI 132 Alex Shinn (12 Mar 2016 23:26 UTC)
Re: more corrections for SRFI 132 John Cowan (13 Mar 2016 22:02 UTC)

Re: more corrections for SRFI 132 John Cowan 13 Mar 2016 22:02 UTC

William D Clinger scripsit:

> Now that I have implemented that procedure, I think it's a really
> strange procedure for this SRFI to be specifying.  It would be more
> useful to have a vector-select procedure such that
>
>     (vector-select < v k [start [end]])
>
> returns
>
>     (vector-ref (vector-sort < v start end) (+ start k))
>
> but probably runs faster because it doesn't have to sort the vector.

I'm adding this to the SRFI as vector-select! and Alex's code as
vector-separate!  I think it makes sense to have both, given that
if you only care about a single value, you can use vector-select!
in O(n) time, whereas if you care about the "top k" values (or
bottom k), you can use vector-separate! also in O(n) time.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
The native charset of SMS messages supports English, French, mainland
Scandinavian languages, German, Italian, Spanish with no accents, and
GREEK SHOUTING.  Everything else has to be Unicode, which means you get
only 70 16-bit characters in a text instead of 160 7-bit characters.