mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-09 20:55:31 -05:00
merge from master
This commit is contained in:
commit
99df5baac2
26 changed files with 50 additions and 49 deletions
|
|
@ -127,13 +127,6 @@ let fprintf oc format =
|
|||
buffer
|
||||
format
|
||||
|
||||
let kfprintf k oc format =
|
||||
let buffer = Buffer.create 64 in
|
||||
Printf.kbprintf
|
||||
(fun fmt -> Buffer.output_buffer oc buffer; k fmt)
|
||||
buffer
|
||||
format
|
||||
|
||||
let printf format = fprintf stdout format
|
||||
let eprintf format = fprintf stderr format
|
||||
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ let append q1 q2 =
|
|||
match q1, q2 with
|
||||
| Shallow Zero, _ -> q2
|
||||
| _, Shallow Zero -> q1
|
||||
| _ -> add_seq_front (to_seq q1) q2
|
||||
| _ -> add_seq_back q1 (to_seq q2)
|
||||
|
||||
let _map_digit f d = match d with
|
||||
| Zero -> Zero
|
||||
|
|
@ -304,7 +304,15 @@ let to_list q =
|
|||
to_seq q (fun x -> l := x :: !l);
|
||||
List.rev !l
|
||||
|
||||
let of_seq seq = add_seq_front seq empty
|
||||
let of_seq seq =
|
||||
let l = ref [] in
|
||||
seq (fun x -> l := x :: !l);
|
||||
List.fold_left (fun q x -> cons x q) empty !l
|
||||
|
||||
(*$Q
|
||||
(Q.list Q.int) (fun l -> \
|
||||
Sequence.of_list l |> of_seq |> to_list = l)
|
||||
*)
|
||||
|
||||
let _nil () = `Nil
|
||||
let _single x cont () = `Cons (x, cont)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue