Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yuroyoro/743127 to your computer and use it in GitHub Desktop.
Save yuroyoro/743127 to your computer and use it in GitHub Desktop.
scala> def Y[A,B](f:((A => B),A) => B,x:A):B = f((y:A) =>Y(f,y),x)
Y: [A,B](f: ((A) => B, A) => B,x: A)B
scala> Y((f:Int => String,n:Int) => n match{case 0 => "ば";case 20 => "あ" + f(n-1);case m =>"ば" + f(n-1);},20)
res32: java.lang.String = あばばばばばばばばばばばばばばばばばばばば
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment