Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Map + Set
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] Map + Set
On Sun, 25 Jul 2004, Martin Jambon wrote:

> Hi,
> 
> I need a functional data structure that has a decent efficiency (i.e.
> not lists) and can represent `sets of named containers' so that I can
> find a container in a set, remove it from the set, update it and put it
> back into the set.
> Normally the Map module should be suitable, but it doesn't
> provide set operations over the keys (union, inter, diff, ...).
> The Set module is almost enough except that it doesn't provide a find
> function:
> 
> val find : elt -> t -> elt  (* yes! *)

A better interface might be:

val find: (elt -> int) -> t -> elt

There is a lot of functionality I'd like to be able to add to map and set.  
I find myself reimplementing them on a regular basis myself (and no, I
haven't thought of a better solution).  Many people on this list don't
like modules, however.


-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian

-------------------
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