Represent a set by its characteristic function, for instance, the set of integers should be like
type Set = Int => Boolean
And given some set and a transform function, the map function should be like
def map(s: Set, f: Int => Int): Set
My original idea was
def map(s: Set, f: Int => Int): Set = (x: Int) => exists(s, (a: Int) => x == f(a))
And I found it seemed hard to implement an unbounded version without iterating in some specific interval to determine whether there is certain "a".
Is it possible to implement an unbounded version in Scala? In other words, theroetically, regardless of the programming language, is it possible to get an unbound version?