mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-10 05:03:54 -05:00
bugfix in CCFQueue
This commit is contained in:
parent
ac180aa339
commit
0fc8aa59f6
1 changed files with 10 additions and 2 deletions
|
|
@ -264,7 +264,7 @@ let append q1 q2 =
|
||||||
match q1, q2 with
|
match q1, q2 with
|
||||||
| Shallow Zero, _ -> q2
|
| Shallow Zero, _ -> q2
|
||||||
| _, Shallow Zero -> q1
|
| _, 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
|
let _map_digit f d = match d with
|
||||||
| Zero -> Zero
|
| Zero -> Zero
|
||||||
|
|
@ -304,7 +304,15 @@ let to_list q =
|
||||||
to_seq q (fun x -> l := x :: !l);
|
to_seq q (fun x -> l := x :: !l);
|
||||||
List.rev !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 _nil () = `Nil
|
||||||
let _single x cont () = `Cons (x, cont)
|
let _single x cont () = `Cons (x, cont)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue