1
2
3
4
def diff(as:List[int]):List[int] = as match {
  case a::(as@b::bs) => (b-a)::diff(as)
  case _      => Nil
}