Suppose I have
val dirty = List(\"a\", \"b\", \"a\", \"c\")
Is there a list operation that returns \"a\", \"b\", \"c\"
You can also use recursion and pattern matching:
def removeDuplicates[T](xs: List[T]): List[T] = xs match { case Nil => xs case head :: tail => head :: removeDuplicates(for (x <- tail if x != head) yield x) }