[racket-dev] Feature request: Vector-sort

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jul 30 02:41:33 EDT 2012

7 hours ago, Harry Spier wrote:
> On Sun, Jul 29, 2012 at 6:12 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > Actually, the `sort' code uses a vector to do its work, which is
> > initialized from the input list.  But it doesn't help much to make it
> > deal with vectors too, since the vector that is used for the sorting
> > work needs to be bigger than the input -- so to sort a vector you'd
> > still need to create a copy.  Given that, you can usually just do the
> > usual (list->vector (sort (vector->list v) <)).
> Thanks Eli.  Thats in fact what I'm presently doing.  i.e. vector->list
> Its on a vector of 26000 structs each consisting of 4 numbers and two
> very short lists of numbers (0-2 or 3 numbers each).

Then you only have the 26000 values to copy -- the contents of the
vector is still the same in the list copy.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.