# BinaryTreeCategory SΒΆ

- S: SetCategory

BinaryTreeCategory(S) is the category of binary trees: a tree which is either empty or has a node consisting of a value and a left and right which are both binary trees.

- =: (%, %) -> Boolean
- from BasicType
- ~=: (%, %) -> Boolean
- from BasicType
- child?: (%, %) -> Boolean
- from RecursiveAggregate S
- children: % -> List %
- from RecursiveAggregate S
- coerce: % -> OutputForm
- from CoercibleTo OutputForm
- copy: % -> %
- from Aggregate
- count: (S, %) -> NonNegativeInteger
- from HomogeneousAggregate S
- cyclic?: % -> Boolean
- from RecursiveAggregate S
- distance: (%, %) -> Integer
- from RecursiveAggregate S
- elt: (%, left) -> %
- from BinaryRecursiveAggregate S
- elt: (%, right) -> %
- from BinaryRecursiveAggregate S
- elt: (%, value) -> S
- from RecursiveAggregate S
- empty: () -> %
- from Aggregate
- empty?: % -> Boolean
- from Aggregate
- eq?: (%, %) -> Boolean
- from Aggregate
- eval: (%, Equation S) -> % if S has Evalable S
- from Evalable S
- eval: (%, List Equation S) -> % if S has Evalable S
- from Evalable S
- eval: (%, List S, List S) -> % if S has Evalable S
- from InnerEvalable(S, S)
- eval: (%, S, S) -> % if S has Evalable S
- from InnerEvalable(S, S)
- hash: % -> SingleInteger
- from SetCategory
- hashUpdate!: (HashState, %) -> HashState
- from SetCategory
- latex: % -> String
- from SetCategory
- leaf?: % -> Boolean
- from RecursiveAggregate S
- leaves: % -> List S
- from RecursiveAggregate S
- left: % -> %
- from BinaryRecursiveAggregate S
- less?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- map: (S -> S, %) -> %
- from HomogeneousAggregate S
- member?: (S, %) -> Boolean
- from HomogeneousAggregate S
- more?: (%, NonNegativeInteger) -> Boolean
- from Aggregate

- node: (%, S, %) -> %
`node(l, v, r)`

creates a binary tree with value`v`

, left subtree`l`

, and right subtree`r`

.- node?: (%, %) -> Boolean
- from RecursiveAggregate S
- nodes: % -> List %
- from RecursiveAggregate S
- right: % -> %
- from BinaryRecursiveAggregate S
- sample: %
- from Aggregate
- size?: (%, NonNegativeInteger) -> Boolean
- from Aggregate
- value: % -> S
- from RecursiveAggregate S

Evalable S if S has Evalable S

InnerEvalable(S, S) if S has Evalable S