Hi all, I'm trying to implement a (string * set) hashtbl where some element (set) should be shared between different objects. the main point is that when I clone an object I want to duplicate some sets and shared others (sticky sets) I tried to achieve this result with the method below. it use the set_copy to duplicate a set and does nothing when then element is marked as "shared". method copy = let set_copy s = MySet.fold ( fun e s -> MySet.add e s ) MySet.empty s in let map_copy m = MyMap.fold ( fun k (s,t) m -> (* this one should be the same set *) if t then MyMap.add k (s,t) m (* this one should be a copy !! *) else MyMap.add k (set_copy(s),t) m ) MyMap.empty m in {< sets = map_copy sets >} Of course this is not the right way of doing it as the map with key "a" (in the small example attached) is not shared at all... this is the result I'd like to get: a1: a(shared) : [1;2;3;] b:[1;2;3;] a2: a(shared) : [1;2;3;4;5;] b:[1;2;3;4;5;] a1: a(shared) : [1;2;3;4;5] <---------------here !!! b:[1;2;3;] how can I efficiently share elements in this kind of structure ? p -- ++ Our capacity for understanding is inversely proportional to how much we think we know. The more I know, the more I know I don't know... ++ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html