algebraische Datentypen:
abstract class Tree[A] case class Leaf[A](key: A) extends Tree[A] case class Branch[A] (left: Tree[A], right: Tree[A]) extends Tree[A]pattern matching:
def size[A](t: Tree[A]): Int = t match { case Leaf(k) => 1 case Branch(l, r) => size(l) + size(r) }