def combinator &b
lambda do |f|
lambda{|x|lambda{|y| f[x[x]] [y]}}[
lambda{|x|lambda{|y| f[x[x]] [y]}}]
end[ lambda{|f|lambda{|n| b[n , &f] }}]
end
a = combinator do | n , &f |
if n == 0
1
else
n * f.call(n-1)
end
end
p a.call 7
def recursion &b
f = ->*n{ b[ *n , &f ] }
end
a = recursion do |n , &rec|
if n == 0
1
else
n * rec.call(n-1)
end
end
p a.call 7
ZGVmIGNvbWJpbmF0b3IgJmIKICBsYW1iZGEgZG8gfGZ8CiAgICBsYW1iZGF7fHh8bGFtYmRhe3x5fCBmW3hbeF1dIFt5XX19WwogICAgICBsYW1iZGF7fHh8bGFtYmRhe3x5fCBmW3hbeF1dIFt5XX19XQogIGVuZFsgbGFtYmRhe3xmfGxhbWJkYXt8bnwgYltuICwgJmZdIH19XQplbmQKIAphID0gY29tYmluYXRvciBkbyB8IG4gLCAmZiB8CiAgaWYgbiA9PSAwCiAgICAxCiAgZWxzZQogICAgbiAqIGYuY2FsbChuLTEpCiAgZW5kCmVuZAogCnAgYS5jYWxsIDcKIAogCiAKZGVmIHJlY3Vyc2lvbiAmYgogIGYgPSAtPipueyBiWyAqbiAsICZmIF0gfQplbmQgCgphID0gcmVjdXJzaW9uIGRvIHxuICwgJnJlY3wKICBpZiBuID09IDAKICAgIDEKICBlbHNlCiAgICBuICogcmVjLmNhbGwobi0xKQogIGVuZAplbmQKcCBhLmNhbGwgNw==