English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Suggestion about balanced trees in stdlib
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-10 (22:31)
From: Stefano Zacchiroli <zack@c...>
Subject: Re: [Caml-list] Suggestion about balanced trees in stdlib
On Fri, May 10, 2002 at 06:59:54PM +0200, Gerd Stolpmann wrote:
> Of course, Set and Map would recur to that more special module.
> Balanced_tree would have the representation of Map, i.e. the elements are
> pairs of keys and attached values. To emulate Set, the value () is used.

I don't know how the compiler treat unit values wrt optimization or
such, but using an unit in each node to emulate Set seems to me
inefficient for a module of the standard library.

I think, but I haven't thought a lot about it, that the problem can be
solved using an implementation polymorphic in the leaf type hidden to
the use that access Set and Map through functors as usual.

Anyway the idea seems really good.

I also suggest to add different kind of visit (i.e. not only iter) like
{pre,post,in}visit via different functions or specifing the desired
behaviour when using the functor or both.


Stefano Zacchiroli - undergraduate student of CS @ Univ. Bologna, Italy
zack@cs.unibo.it | ICQ# 33538863 | http://www.cs.unibo.it/~zacchiro
"I know you believe you understood what you think I said, but I am not
sure you realize that what you heard is not what I meant!" -- G.Romney
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