Page
Library
Module
Module type
Parameter
Class
Class type
Source
Regenerate.Make
SourceRegenerate.Make(W)(S)(A)
is a module that implements sample generation for words implemented by the module W
with the alphabet A
. S
describes the data structure used internally for the enumeration of words.
For casual use of the library, consider using arbitrary
instead.
module Segment : Segments.S with type elt = Word.t
pp fmt lang
pretty print the language lang
.
val sample :
?st:Random.State.t ->
?n:int ->
?firsts:int ->
skip:int ->
lang ->
(Segment.elt -> unit) ->
res
sample ~skip ~n lang
returns a sequence of on average n
elements. lang
is only consumed when needed.
We sample one element every k
, where k
follows a power law of average skip
. Furthermore, if we consume more than sqrt k
empty segments, we assume that the rest of the segments will be infinitely empty and stop.
If firsts
is provided, we always output the firsts
first elements.
flatten lang
returns the sequence of its segments.