module IP = struct type t = int * string let compare x y = let (i, _) = x and (j, _) = y in compare i j end;; module PS = Set.Make(IP);; let ss = ref PS.empty;; for i=0 to 10 do ss := PS.add (i, string_of_int i) !ss done;; PS.elements !ss;; (* - : PS.elt list = [(0, "0"); (1, "1"); (2, "2"); (3, "3"); (4, "4"); (5, "5"); (6, "6"); (7, "7"); (8, "8"); (9, "9"); (10, "10")] *) PS.elements (PS.add (3, "trois") (PS.singleton (3, "three")));; (* - : PS.elt list = [(3, "three")] (* senority! *) *)