This commit is contained in:
Nicola Mometto 2018-03-06 11:09:42 +00:00 committed by GitHub
commit 8fa1f85f1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -102,9 +102,9 @@ let rec of_gen g =
Q.(list int) (fun l -> l = (Gen.of_list l |> of_gen |> to_list)) Q.(list int) (fun l -> l = (Gen.of_list l |> of_gen |> to_list))
*) *)
let rec of_list = function let rec of_list ?(f = fun x -> x) = function
| [] -> empty | [] -> empty
| x :: tl -> cons x (of_list tl) | x :: tl -> cons (f x) (of_list ~f tl)
let to_list_rev l = let to_list_rev l =
let rec aux acc = function let rec aux acc = function

View file

@ -56,7 +56,7 @@ type 'a gen = unit -> 'a option
val of_gen : 'a gen -> 'a t val of_gen : 'a gen -> 'a t
val of_list : 'a list -> 'a t val of_list : ?f:('a -> 'b) -> 'a list -> 'b t
val to_list : 'a t -> 'a list val to_list : 'a t -> 'a list