(************************************************************ touple_set.ml Created : Sun Nov 3 02:04:04 2002 Last modified: Sun Nov 03 02:10:03 2002 Compile: ocamlopt.opt touple_set.ml -o touple_set # ************************************************************) (** @author Takashi Masuyama *) module StringTouple = struct type t = string * string let compare (x1,y1) (x2,y2) = if x1 < x2 then -1 else if x1 = x2 then if y1 < y2 then -1 else if y1 = y2 then 0 else 1 else 1 end module StringToupleSet = Set.Make(StringTouple) let _ = let data = [("hoge","moge"); ("tak", "mamewo"); ("aki", "okui") ] in StringToupleSet.iter (fun (x,y) -> Printf.printf "%s\t%s\n" x y) (List.fold_right StringToupleSet.add data StringToupleSet.empty)