Parent

com.phasmidsoftware.lascala.tree.Parent
See theParent companion trait
object Parent

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Parent.type

Members list

Value members

Concrete methods

def apply[T : Parent]: Parent[T]
final def traverse[P : Parent, S, R](f: P => S, g: (R, S) => R, q: R => Boolean = ...)(ts: Seq[P], r: R): R

Generic tail-recursive tree-traversal method.

Generic tail-recursive tree-traversal method.

Type parameters

P

a type which extends Parent, and thus has children of type T -- this "context bound" is implemented via a compiler-generated implicit parameter of type Parent[T].

R

the result type.

S

the return type of f, typically an Option[X] where X is something that can be combined with an R.

Value parameters

f

the map function which takes a T and produces an S for just that parent object (not its children).

g

the reduce function which accumulates the result (the accumulator is passed as its first parameter and an S value is passed as the second).

q

the quick return function which, if q(r) yields true, the method immediately returns r. Defaults to always false.

r

the current value of the result, i.e. the "accumulator".

ts

a list of Ts to be worked on.

Attributes

Returns

a value of R.