(************************************************************ set_diff.ml Created : Mon Jan 9 19:37:13 2006 Last modified: Mon Jan 09 19:46:05 2006 Compile: ocamlc -dtypes set_diff.ml -o set_diff # FTP Directory: sources/ocaml # ************************************************************) (** @author Takashi Masuyama *) module Int = struct type t = int let compare = compare end module IntSet = Set.Make(Int) let _ = let lst1 = [ 1; 2; 3; 4 ] in let lst2 = [ 3; 4; 5; 6 ] in let s1 = List.fold_right IntSet.add lst1 IntSet.empty in let s2 = List.fold_right IntSet.add lst2 IntSet.empty in let diff = IntSet.diff s1 s2 in print_endline "diff"; IntSet.iter (fun x -> Printf.printf "%d\n" x) diff (* * Local Variables: * namazu-default-dir "/home/tak/.indexes/ocaml" * End: *)