sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Small library to evaluate simple arithmetic expressions.
This library evaluates simple arithmetic expression over floats. Regular operators (+,-,*,/,^) and some regular functions (sin, cos, tan, asin, acos, atan, log, log10, exp, sqrt) are implemented. Arithmetic expressions can contain variables.
Here is an example of expression : 3*x+sin(2)
.
Type of tree which represent an arithmetic expression
module Env : sig ... end
Variable environment.
Compress a tree in the given environment, ie. evaluate everything that can be evaluated.
val eval_custom : ('a -> float) -> 'a t -> float
Evaluate a tree, the given function is used to evaluate variables.
Compress a tree using the given function, ie. evaluate everything that can be evaluated. A variable is untouched if the function returns None
.
val fold : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
Depth first left to right traversal of the tree.
val iter :
?var:('a -> unit) ->
?float:(float -> unit) ->
?op1:(op1 -> unit) ->
?op2:(op2 -> unit) ->
'a t ->
unit
Iteration on everything.
val vars : 'a t -> ('a -> unit) -> unit
Get the sequence of variables in the given tree. Use with sequence or containers.