Why is a Set a function?

后端 未结 2 1578
醉梦人生
醉梦人生 2021-02-13 03:20

In Scala a Set is a function:

trait Set[A] extends (A => Boolean)

This make it impossible to have a covariant immutable S

2条回答
  •  醉梦人生
    2021-02-13 03:39

    In contrast Seq is not defined as a function.

    Not true.

    Seq[T] extends (Int) => T
    

提交回复
热议问题