mirror of
https://github.com/c-cube/iter.git
synced 2025-12-05 19:00:31 -05:00
reformat
This commit is contained in:
parent
92d0022079
commit
399e95b50f
5 changed files with 30 additions and 26 deletions
|
|
@ -2,6 +2,7 @@
|
|||
(names bench_persistent_read bench_persistent benchs)
|
||||
(libraries iter benchmark)
|
||||
(optional)
|
||||
(flags :standard -w +a-4-42-44-48-50-58-32-60-70@8 -safe-string -color always)
|
||||
(flags :standard -w +a-4-42-44-48-50-58-32-60-70@8 -safe-string -color
|
||||
always)
|
||||
(ocamlopt_flags :standard -O3 -color always -unbox-closures
|
||||
-unbox-closures-factor 20))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
(executable
|
||||
(name test_sexpr)
|
||||
(libraries iter)
|
||||
(flags :standard -w +a-4-42-44-48-50-58-32-60-70@8 -safe-string -color always)
|
||||
(flags :standard -w +a-4-42-44-48-50-58-32-60-70@8 -safe-string -color
|
||||
always)
|
||||
(ocamlopt_flags :standard -O3 -color always -unbox-closures
|
||||
-unbox-closures-factor 20))
|
||||
|
|
|
|||
12
src/Iter.ml
12
src/Iter.ml
|
|
@ -189,7 +189,9 @@ let keep_error seq k =
|
|||
|
||||
(** Mutable unrolled list to serve as intermediate storage *)
|
||||
module MList = struct
|
||||
type 'a node = Nil | Cons of { a : 'a array; mutable n : int; mutable tl : 'a node }
|
||||
type 'a node =
|
||||
| Nil
|
||||
| Cons of { a: 'a array; mutable n: int; mutable tl: 'a node }
|
||||
|
||||
(* build and call callback on every element *)
|
||||
let of_iter_with seq k =
|
||||
|
|
@ -202,9 +204,9 @@ module MList = struct
|
|||
match !acc with
|
||||
| Nil -> acc := !cur
|
||||
| _ ->
|
||||
match !tail with
|
||||
(match !tail with
|
||||
| Nil -> ()
|
||||
| Cons r -> r.tl <- !cur
|
||||
| Cons r -> r.tl <- !cur)
|
||||
in
|
||||
|
||||
seq (fun x ->
|
||||
|
|
@ -673,7 +675,9 @@ let map_while f seq k =
|
|||
let consume x =
|
||||
match f x with
|
||||
| `Yield y -> k y
|
||||
| `Return y -> k y; raise_notrace ExitMapWhile
|
||||
| `Return y ->
|
||||
k y;
|
||||
raise_notrace ExitMapWhile
|
||||
| `Stop -> raise_notrace ExitMapWhile
|
||||
in
|
||||
try seq consume with ExitMapWhile -> ()
|
||||
|
|
|
|||
1
src/dune
1
src/dune
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
(library
|
||||
(name iter)
|
||||
(public_name iter)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
(tests
|
||||
(names t_iter)
|
||||
(libraries iter qcheck-core qcheck-core.runner ounit2))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue