タグ

ブックマーク / slides.com (1)

  • rpscala162

    sealed trait IntList case object IntNil extends IntList case class IntCase(head: Int, tail: IntList) extends IntList def sum(list: IntList): Int = list match { case IntNil => 0 case IntCons(head, tail) => head + sum(tail) } def product(list: IntList): Int = list match { case IntNil => 1 case IntCons(head, tail) => head * product0(tail) } sealed trait IntList case object IntNil extends IntList case

    rpscala162
    Ehren
    Ehren 2015/12/03
  • 1