https://yourbasic.org/algorithms/induction-recursive-functions/
Implements the functions with the following definitions:
def f[A](as: List[List[A]]): List[A]
def g[A, B](as: List[A], f: A => List[B]): List[B]
def h[A, B](as: Option[A], f: A => Option[B]): Option[B]