Skip to content

Instantly share code, notes, and snippets.

View claussni's full-sized avatar

Ralf Claussnitzer claussni

View GitHub Profile
abstract class Tree
case class Leaf(value: String) extends Tree
case class Branch(left: Tree, right: Tree) extends Tree
def walk(t: Tree): Unit =
t match {
case Branch(Stub, _) => println("branch-with-stub-on-the-left")
case Branch(left, right) => {
println("\nbranch-leaf")
walk(left)