From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA16832; Wed, 30 Jun 2004 14:11:18 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA16823 for ; Wed, 30 Jun 2004 14:11:17 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5UCBGSH005900 for ; Wed, 30 Jun 2004 14:11:16 +0200 Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i5UCBGfY031393 for ; Wed, 30 Jun 2004 14:11:16 +0200 (CEST) X-Ids: 168 Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id OAA123150 for ; Wed, 30 Jun 2004 14:09:23 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id OAA573682 for ; Wed, 30 Jun 2004 14:09:25 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Wed, 30 Jun 2004 14:09:24 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: caml-list@inria.fr Subject: [Caml-list] Data structure for efficient maps ? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 40E2ADE4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 40E2ADE4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pons:01 pons:01 etu:99 failwith:01 fernandez:01 fernandez:01 olivier:02 olivier:02 inner:02 purely:02 argument:03 rebuild:03 data:03 data:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, Does anyone know about a persistent (purely functional) data structure designed to handle efficiently inner maps for integers ? The only way I know to do this is to rebuild completely the data structure by something like map f data = from_list (List.map f (to_list data)) which isn't very efficient when handling large data sets example of use let sigma = function | 0 -> 1 | 1 -> 2 | 2 -> 6 | 3 -> 3 | 4 -> 0 | 5 -> 4 | 6 -> 5 | _ -> failwith "invalid argument" let myset = Set.from_list [0;4;5;6] let newset = Set.map sigma myset (* should be efficent here *) # Set.to_list newset - [0;1;4;5] Diego Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners