From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@etu.upmc.fr>
To: caml-list@inria.fr
Subject: [Caml-list] Data structure for efficient maps ?
Date: Wed, 30 Jun 2004 14:09:24 +0200 (DST) [thread overview]
Message-ID: <Pine.A41.4.44.0406301407420.979042-100000@ibm1> (raw)
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
reply other threads:[~2004-06-30 12:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.A41.4.44.0406301407420.979042-100000@ibm1 \
--to=diego.fernandez_pons@etu.upmc.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox