Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Announce: xsetxmap, unfunctorized, Sexp-lib aware versions of Set and Map
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-04-23 (14:23)
From: Berke Durak <berke.durak@e...>
Subject: Re: [Caml-list] Announce: xsetxmap, unfunctorized, Sexp-lib awareversions of Set and Map
David Allsopp wrote:
> Brian Hurt wrote:
>> Jon Harrop wrote:
> Agreed - then we could also have more sensibly located functions such as
> Int.of_string (note that it's the same length as int_of_string!!) and remove
> lots of random functions from Pervasives!

Of course we'll just add an extra Int module and leave Pervasives alone, or at
least make it trigger a warning.

> All that said, and especially as StdLib changes are reasonably rare, I find
> having files and IntSet.mli containing:
> include Set.Make(struct type t = int let compare = end)
> and
> include Set.S with type elt = int
> isn't too bad (except that you have to include IntSet.cmo/.cmx when
> compiling, obviously)

I agree, and someone might write an optimized version for ints or floats.

But Xset & Xmap also provide opportunities to add some missing functions.
In particular, I often use Sets or Maps as a good priority queue/heap substitute, and
reverse_fold / reverse_iter come in handy.

The only problem is that I have an allergy to CamlCaseIdentifiers but I'll
just swallow some antiHistaminics.