Module Abt.Var
Variables, named by strings, which can be bound to a Var.Binding
or left free.
module Binding : sig ... end
A binding is an immutable reference, to which a bound can refer.
type t
= private
|
Free of string
|
Bound of Binding.t
A varibale of type
t
is either free or bound.
val compare : t -> t -> int
Bound variables are equal if they are have the same binding, free variables are greater than bound variables, and variables are otherwise compared lexigraphically by name.
Specifically,
compare a b
is0
iffis_free a && is_free b
andname a = name b
is_bound a && is_bound b
and botha
andb
are bound to the samebinding
by way ofbind
.
compare a b
isString.compare (name a) (name b)
ifis_free a && is_free b
oris_bound a && is_bound b
.compare a b
is -1 ifis_bound a
andis_free b
or 1 ifis_free a
andis_bound b
val equal : t -> t -> bool
equal a b
istrue
iffis_free a && is_free b
andname a = name b
is_bound a && is_bound b
and botha
andb
are bound to the samebinding
by way ofbind
.
val is_free : t -> bool
val is_bound : t -> bool
val v : string -> t
val to_string : t -> string
val to_string_debug : t -> string
Includes the unique ID of any bound variables
val name : t -> string
name v
isto_string v