progs/app7.scala
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 24 Jan 2022 00:14:02 +0000
changeset 870 739039774cee
parent 295 19f23c4c2167
permissions -rw-r--r--
ivy import not needed

abstract class Parser[I, T] {
  def parse(ts: I): Set[(T, I)]

  def parse_all(ts: I) : Set[T] =
    for ((head, tail) <- parse(ts); 
         if (tail.isEmpty)) yield head
}