package term-tools
Module Make.ZipperSource
Zipper.
This module implements zippers over first-order terms.
For advanced users: as an extension over plain zippers, the module also allows to edit a term lazily applied to a substitution. In plain words, the variables contained in terms may point to other terms, specified by a substitution provided at zipper creation time. One can then navigate and edit the induced graph in a purely applicative fashion.
The type of zippers.
For plain zippers, 'a with_state = 'a. When doing term graph edition, this type encapsulates the underlying substitution.
of_term t is the zipper of the term t.
to_term z is the term represented by the zipper z.
For experienced users only. deref z is
Nonewhencursor zis not a variable- If
cursor zis a variablekandkis not bound in the underlying substitution,deref zis alsoNone - Otherwise,
deref zisSome z'wherez'is a zipper located at the term associated tok.
move_at z i is the zipper obtained by moving at the index i.
For experienced users/experimental: when doing term graph edition, in the case where cursor z is a variable in the domain of the underlying substitution, move_at z i will silently perform a deref before moving at the index i of the obtained term.
move_at_exn z i is the exception-raising vaeriant of move_at.
Raises Invalid_argument if i is out of bounds.
replace t z is the zipper obtained by replacing the term at the focus of z by t.
fold f acc z folds a zipper over the subterms of cursor z (including cursor z).
fold does not follow the links given by the substitution underlying z, if any.