Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Frédéric_Gava <frederic.gava@w...>
Subject: Missing a function
Hi,

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 ;-) ) ?

Cheers,
Frédéric Gava