mirror of
https://github.com/c-cube/iter.git
synced 2025-12-06 03:05:29 -05:00
test the conversion to set
This commit is contained in:
parent
fa412b7ece
commit
2ca708d41a
1 changed files with 7 additions and 0 deletions
7
tests.ml
7
tests.ml
|
|
@ -8,6 +8,9 @@ let rec pp_list ?(sep=", ") pp_item formatter = function
|
|||
| x::[] -> pp_item formatter x
|
||||
| [] -> ()
|
||||
|
||||
(** Set of integers *)
|
||||
module ISet = Set.Make(struct type t = int let compare = compare end)
|
||||
|
||||
let _ =
|
||||
let l = [0;1;2;3;4;5;6] in
|
||||
let l' = Sequence.List.of_seq
|
||||
|
|
@ -23,9 +26,13 @@ let _ =
|
|||
(Sequence.Hashtbl.to_seq h))
|
||||
in
|
||||
let l3 = Sequence.List.of_seq (Sequence.rev (Sequence.Int.range ~start:0 ~stop:42)) in
|
||||
let set = List.fold_left (fun set x -> ISet.add x set) ISet.empty [4;3;100;42] in
|
||||
let s = (module ISet : Set.S with type elt = int and type t = ISet.t) in
|
||||
let l4 = Sequence.List.of_seq (Sequence.Set.to_seq s set) in
|
||||
Format.printf "l=@[<h>[%a]@]@." (pp_list Format.pp_print_int) l;
|
||||
Format.printf "l'=@[<h>[%a]@]@." (pp_list Format.pp_print_int) l';
|
||||
Format.printf "l''=@[<h>[%a]@]@." (pp_list Format.pp_print_int) l'';
|
||||
Format.printf "l2=@[<h>[%a]@]@." (pp_list Format.pp_print_string) l2;
|
||||
Format.printf "l3=@[<h>[%a]@]@." (pp_list Format.pp_print_int) l3;
|
||||
Format.printf "l4=@[<h>[%a]@]@." (pp_list Format.pp_print_int) l4;
|
||||
()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue