From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA32381 for caml-red; Sun, 3 Dec 2000 23:04:08 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA12278 for ; Thu, 30 Nov 2000 12:39:28 +0100 (MET) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.6.1]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eAUBdRb28818 for ; Thu, 30 Nov 2000 12:39:27 +0100 (MET) Received: from lambda.u-strasbg.fr (lambda.u-strasbg.fr [130.79.90.63]) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id MAA05208; Thu, 30 Nov 2000 12:38:35 +0100 Received: from luther by lambda.u-strasbg.fr with local (Exim 3.16 #1 (Debian)) id 141SBv-0003s4-00; Thu, 30 Nov 2000 12:47:55 +0100 Date: Thu, 30 Nov 2000 12:47:54 +0100 To: John Max Skaller Cc: Mattias Waldau , caml-list@inria.fr Subject: Re: sorting of list of vectors (array with one dimension) Message-ID: <20001130124754.A14873@lambda.u-strasbg.fr> References: <3A2603CF.698A368D@ozemail.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3A2603CF.698A368D@ozemail.com.au>; from skaller@ozemail.com.au on Thu, Nov 30, 2000 at 06:37:51PM +1100 From: Sven LUTHER Sender: weis@pauillac.inria.fr 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