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
은 오는가? 어떻게 그럴 수 있습니까?