Tree

sealed abstract
class Tree[A]

Inspired from the scalaz (https://github.com/scalaz/scalaz) project

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def rootLabel: A

The label at the root of this tree.

The label at the root of this tree.

def subForest: LazyList[Tree[A]]

The child nodes of this tree.

The child nodes of this tree.

Concrete methods

def cobind[B](f: Tree[A] => B): Tree[B]

Binds the given function across all the subtrees of this tree.

Binds the given function across all the subtrees of this tree.

def drawTree(using sh: Show[A]): String

A 2D String representation of this Tree.

A 2D String representation of this Tree.

def flatMap[B](f: A => Tree[B]): Tree[B]
def flatten: LazyList[A]

Pre-order traversal.

Pre-order traversal.

def foldMap[B](f: A => B)(using evidence$1: Monoid[B]): B

Maps the elements of the Tree into a Monoid and folds the resulting Tree.

Maps the elements of the Tree into a Monoid and folds the resulting Tree.

def foldNode[Z](f: A => LazyList[Tree[A]] => Z): Z
def foldRight[B](z: => B)(f: (A, => B) => B): B
def levels: LazyList[LazyList[A]]

Breadth-first traversal.

Breadth-first traversal.

def loc: TreeLoc[A]

A TreeLoc zipper of this tree, focused on the root node.

A TreeLoc zipper of this tree, focused on the root node.

def map[B](f: A => B): Tree[B]
def scanr[B](g: (A, LazyList[Tree[B]]) => B): Tree[B]

A histomorphic transform. Each element in the resulting tree is a function of the corresponding element in this tree and the histomorphic transform of its children.

A histomorphic transform. Each element in the resulting tree is a function of the corresponding element in this tree and the histomorphic transform of its children.

def size: Int

return the size of the tree == the number of labels

return the size of the tree == the number of labels

def unzip[A1, A2](using p: A => (A1, A2)): (Tree[A1], Tree[A2])

Turns a tree of pairs into a pair of trees.

Turns a tree of pairs into a pair of trees.