sig
type op2 = Plus | Minus | Times | Div | Pow
type op1 = Func of (float -> float) | MinusUn
type 'a t =
Float of float
| Op2 of 'a Calc.t * Calc.op2 * 'a Calc.t
| Op1 of Calc.op1 * 'a Calc.t
| Var of 'a
module Env :
sig
type t
val add : string -> float -> Calc.Env.t -> Calc.Env.t
val mem : string -> Calc.Env.t -> bool
val union : Calc.Env.t -> Calc.Env.t -> Calc.Env.t
val of_list : (string * float) list -> Calc.Env.t
val empty : Calc.Env.t
val usual : Calc.Env.t
end
exception Unknown_variable of string
val eval : Calc.Env.t -> string Calc.t -> float
val compress : Calc.Env.t -> string Calc.t -> string Calc.t
val eval_custom : ('a -> float) -> 'a Calc.t -> float
val compress_custom : ('a -> float option) -> 'a Calc.t -> 'a Calc.t
val bind : ('a -> 'b Calc.t) -> 'a Calc.t -> 'b Calc.t
val bind_opt : ('a -> 'a Calc.t option) -> 'a Calc.t -> 'a Calc.t
val fold : ('a -> 'b -> 'b) -> 'a Calc.t -> 'b -> 'b
val map : ('a -> 'b) -> 'a Calc.t -> 'b Calc.t
val iter :
?var:('a -> unit) ->
?float:(float -> unit) ->
?op1:(Calc.op1 -> unit) -> ?op2:(Calc.op2 -> unit) -> 'a Calc.t -> unit
val vars : 'a Calc.t -> ('a -> unit) -> unit
val closure :
?env:Calc.Env.t ->
string Calc.t -> (string * 'a) list -> ('a -> float) -> float
end