Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Berke Durak <berke.durak@g...>
Subject: Re: [Caml-list] Announce: xsetxmap, unfunctorized, Sexp-lib aware versions of Set and Map
Yes you are right, I should have put a warning.  These modules are for
peculiar cases.
So here it is:

WARNING:  The default comparison function is not sound for non-canonical
datastructures such
as Sets and Maps.  Xset is not canonical.  Do not use Xsets or Xmap without
providing the correct
comparison function.  You must always pass the same comparison function.

(That's why I was asking if there was a Set/Map structure with canonical
representation the other day.)

Extlib provides a version where the comparison function for the keys is
stored in the map.
But I chose to not do this for some peculiar reasons.
  - I'm serializing Xmap and Xsets using Marshal, and I don't want to have
functions in the structure
  - I don't like the overhead of a wrapper structure and I don't want to
complicate the API
-- 
Berke Durak