accumulate.scala