package gen
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Iterators for OCaml, both restartable and consumable
Install
dune-project
Dependency
Authors
Maintainers
Sources
0.5.2.tar.gz
md5=dd731ef527022ea698955db687e6cb5f
sha512=c84e5ea0c9b3a678b6a5c935eacf91265a79b68a48375c44aa5f159d4cb02283c1be0786e172a153666c670bc7ee37b931004b8747a99e5f4ab90ca63e097ff5
doc/gen/GenClone/index.html
Module GenClone
Clonable Generators
Utils to save the internal state of a generator, and restart from this state. This will and should not work on any iterator, but for some of them (e.g. reading from a file, see IO) it makes a lot of sense.
A generator that can be cloned as many times as required.
type 'a clonable = 'a tAlias to 'at
Prepend method
type 'a prependable =
< gen : 'a gen
; clone : 'a prependable
; prepend : 'a -> unit >val to_prependable : 'a t -> 'a prependableMisc
Low-level Persistency
Example:
let g = 1 -- 1000 ;;
val g : int t = <fun>
let c = g |> MList.of_gen_lazy |> MList.to_clonable;;
val c : int clonable = <obj>
c#next |> take 500 |> to_list;;
- : int list = [1; 2; 3; .....; 500]
let c' = c#clone ;;
val c' : int clonable = <obj>
c |> to_list;;
- : int list = [501; 502; ....; 1000]
c'#gen |> to_list;; (* c consumed, but not c' *)
- : int list = [501; 502; ....; 1000]
c#gen |> to_list;;
- : int list = []IO
module IO : sig ... end sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page