package gen
Simple and efficient iterators (modules Gen and GenLabels).
Install
Dune Dependency
Authors
Maintainers
Sources
0.5.1.tar.gz
sha256=2bc625f816a4c2efe3a781552551862e7eacca26a1000ea3698fa4c08eec2c6a
md5=4fb545ddde26dd084f01210681df4c14
doc/gen/GenMList/index.html
Module GenMList
Efficient Mutable Lists
Unrolled lists, append-only, used for storing the content of a generator.
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 = []
of_gen_lazy g
makes a mlist that will read from g
as required, until g
is exhausted. Do not use g
directly after this, or some elements will be absent from the mlist!
Iterate on the mlist. This function can be called many times without any problem, the mlist isn't consumable!
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page