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
Strange observation on polymorphic '<'
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-04 (11:03)
From: Frédéric_Gava <frederic.gava@w...>
Subject: Missing a function

I have done a comparaison on three data structures of the stdlib of OCaml (I
do parallel implementation of this data structure) and I find that the
module Map does not contain any function for counting the number of elements
of the data structure:
   Set, cardinal: t -> int
   Hashtbl,  lenght : ('a,'b) t -> int
   Map,    you have to do   "let length the_map = fold (fun _ _ i -> i+1)
the_map 0 "

And Set and Hastbl have also fold...

Is there an explanation (or is it just a missing ;-) ) ?

Frédéric Gava