Jump to content

Y combinator: Difference between revisions

m
→‎{{header|Scala}}: added parentheses for clarity
(→‎{{header|Scala}}: add type annotation)
m (→‎{{header|Scala}}: added parentheses for clarity)
Line 4,461:
<lang scala>
def Y[A, B](f: (A => B) => (A => B)): A => B = {
case class W(wf: W => (A => B)) {
def apply(w: W): A => B = wf(w)
}
val g: W => (A => B) = w => f(w(w))(_)
g(W(g))
}
92

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.