Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven LUTHER <luther@d...>
Subject: Re: sorting of list of vectors (array with one dimension)
On Thu, Nov 30, 2000 at 06:37:51PM +1100, John Max Skaller wrote:
> Mattias Waldau wrote:
> > 
> > I have a list of vectors, I would like to sort according to the first
> > vector, and move the corresponding data in the other vectors.
> > 
> > Is there a function for this (for example, a sort function, where I add a
> > function that is called each time data is swapped) or do I have to write a
> > quicksort in ocaml.

why not use a associative map or something such instead of a list of vectors ?
you would use the content of the first vector as key, and the other vectors as
data. This way you get a datatype which is ordered as stored, and which give
you faster random access & modify time than a list. It still is a fully
functional datatype.

Friendly,

Sven Luther