mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
bugfixes in Gen.of_array
This commit is contained in:
parent
939e0b96d0
commit
ec066c5386
1 changed files with 3 additions and 3 deletions
6
gen.ml
6
gen.ml
|
|
@ -851,12 +851,12 @@ let to_array enum =
|
|||
|
||||
let of_array ?(start=0) ?len a =
|
||||
let len = match len with
|
||||
| None -> Array.length a
|
||||
| Some n -> assert (n <= Array.length a); n in
|
||||
| None -> Array.length a - start
|
||||
| Some n -> assert (n + start < Array.length a); n in
|
||||
fun () ->
|
||||
let i = ref start in
|
||||
fun () ->
|
||||
if !i >= len
|
||||
if !i >= start + len
|
||||
then raise EOG
|
||||
else (let x = a.(!i) in incr i; x)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue