1
これはクロージャに関するものであるかどうかはわかりませんが、次のコードではe
については理由が分かりません。スカラの閉包について理解していますか?
type Set = Int => Boolean
/* characteristic function of Set */
def contains(s: Set, elem: Int): Boolean = s(elem)
/* definition of a singleton set, returning a set of only one given element */
def singletonSet(elem: Int): Set = e => e == elem
上記のコードでは、e
はどこから来たのですか?それについてどうすればいいのですか?