Working with Sets as Functions
From a FP course: type Set = Int => Boolean // Predicate /** * Indicates whether a set contains a given element. */ def contains(s: Set, elem: Int): Boolean = s(elem) Why would that make sense? assert(contains(x => true, 100)) Basically what it does is provide the value 100 to the function x => true . I.e., we provide 100, it returns true . But how is this related to sets? Whatever we put, it returns true . Where is the sense of it? I understand that we can provide our own set implementation/function as a parameter that would represent the fact that provided value is inside a set (or not) -