module Make(
Lstream
:
S
)
:sig
..end
The important operations from the performance point of view are expand
and map
.
Concatenation (as used in expand
) must absolutely be in O(1) amortized time. Laziness is better for memory occupation but is not necessary.
Parameters: |
|
val eval_lsys : int ->
('a * string Calc.t list) Lilis.lsystem -> ('a * float array) Lstream.t
One of the steps of compression is to transform string symbols into int.
To be allowed to transform back and forth a lstream, the compress_lstream
function provides an environment from string symbols to int.
This environment can be used by compress_lstream
and uncompress_lstream
for O(n) compression/uncompression. The laziness of Lstream
is respected.
type'a
lstream =('a * float array) Lstream.t
type 'a
crules
val compress_rules : Lilis.SymbEnv.t ->
(string * string Calc.t list) Lilis.rule list -> int crules
val compress_post_rules : Lilis.SymbEnv.t ->
('a * string Calc.t list) Lilis.rule list -> 'a crules
val compress_lslist : Lilis.SymbEnv.t -> string Lilis.stream -> (int * float array) Lstream.stored
val compress_lsys : ('a * string Calc.t list) Lilis.lsystem ->
Lilis.SymbEnv.t * (int * float array) Lstream.stored *
int crules * 'a crules
val compress_lstream : Lilis.SymbEnv.t -> string lstream -> int lstream
val uncompress_lstream : Lilis.SymbEnv.t -> int lstream -> string lstream
val map_crules : ('a -> 'b) -> 'a crules -> 'b crules
val apply : ?n:int ->
int crules -> int lstream -> int lstream
apply rules lstream
will apply rules once to lstream
. The optional argument n
can be used to apply more than once.val apply_complete : 'a crules -> int lstream -> 'a lstream
apply
but with a complete mapping. Symbols without rules are suppressed.val eval_lsys_uncompress : int ->
('a * string Calc.t list) Lilis.lsystem -> (string * float array) Lstream.t
eval_lsys
, but will ignore post rules and uncompress the stream instead.val iter_complete : ((float array -> float) array -> float array -> unit) crules ->
int lstream -> unit
val eval_iter_lsys : int ->
('a * string Calc.t list) Lilis.lsystem ->
store:bool ->
('a -> (float array -> float) array -> float array -> unit) -> unit -> unit
val eval_fold_lsys : int ->
('a * string Calc.t list) Lilis.lsystem ->
store:bool ->
('a -> (float array -> float) array -> 'b -> float array -> 'b) -> 'b -> 'b