是否有可能在一组上获得无界地图功能?

Ziq*_*iqi 6 functional-programming scala higher-order-functions

例如,通过其特征函数表示集合,应该是整数集合

type Set = Int => Boolean  
Run Code Online (Sandbox Code Playgroud)

并且给定了一些set和transform函数,map函数应该是这样的

def map(s: Set, f: Int => Int): Set  
Run Code Online (Sandbox Code Playgroud)

我最初的想法是

def map(s: Set, f: Int => Int): Set = (x: Int) => exists(s, (a: Int) => x == f(a))  
Run Code Online (Sandbox Code Playgroud)

并且我发现在没有在某个特定间隔内迭代以确定是否存在某些"a"的情况下,实现无界版本似乎很难.

是否可以在Scala中实现无界版本?换句话说,无论编程语言如何,理论上都可以获得一个未绑定的版本?