Version française
Home     About     Download     Resources     Contact us    
Browse thread
Sorted list
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] Sorted list
On Sat, 04 Aug 2007 14:23:15 +0200, Philippe Wang wrote:
> 
> It works ! ... Or did I miss something ?

Do not be satisfied after a quick test!

# module S = Set.Make(struct type t = int let compare : t -> t -> int = fun 
a b -> match compare a b with 0 -> 1 | n -> n end);;
# let x = S.add 1 (S.add 1 S.empty);;
# S.elements x;;
- : S.elt list = [1; 1]

# S.mem 1 x;;
- : bool = false

# S.equal x x;;
- : bool = false

# S.elements(S.remove 1 x);;
- : S.elt list = [1; 1]

Is that what you expect?

Cheers,
ChriS