henix / blog

some notes
0 stars 0 forks source link

Scala Y-combinator #16

Open henix opened 10 years ago

henix commented 10 years ago

http://stackoverflow.com/questions/5337464/anonymous-recursive-function-in-scala

def y[A,B](f: (A=>B)=>(A=>B)): A=>B = f(y(f))(_)

Y-combinator 本来不能在有类型的函数式语言中实现。这里由于使用了名称绑定