Module Tree


module Tree: sig  end
Represents the empty forest.


type 'a t =
| Empty_tree (*Represents the empty forest.*)
| Node of 'a * 'a t list (*Represents the tree as a pair of a label and the list of successors.*)
exception Empty_forest
Empty_forest is raised whenever an operation is called for an empty forest, i.e. a tree list with 0 elements.
val sons : 'a t -> 'a t list
sons x returns the list of direct successors of the tree x.
val nth : int -> 'a t -> 'a t
nth n x returns the n-th successor of x.
val label : 'a t -> 'a
label x returns the label of the root node of x.
val to_string : 'a t -> ('a -> string) -> string
to_string x returns a string representation of x.
val to_xml : 'a t -> ('a -> string) -> string
to_xml x returns an XML representation of x.
val read : string -> (string -> 'a) -> 'a t
read s f reads a tree encoded as XML from file s and returns it.