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 &block
lambda do |*h|
g = lambda{|*h| block.call(*h , &g)}
g.call(*h)
end
end
a = recursion do |n , &rec|
if n == 0
1
else
n * rec.call(n-1)
end
end
p a.call 7
CmRlZiBjb21iaW5hdG9yICZiCiAgbGFtYmRhIGRvIHxmfAogICAgbGFtYmRhe3x4fGxhbWJkYXt8eXwgZlt4W3hdXSBbeV19fVsKICAgICAgbGFtYmRhe3x4fGxhbWJkYXt8eXwgZlt4W3hdXSBbeV19fV0KICBlbmRbIGxhbWJkYXt8ZnxsYW1iZGF7fG58IGJbbiAsICZmXSB9fV0KZW5kCgphID0gY29tYmluYXRvciBkbyB8IG4gLCAmZiB8CiAgaWYgbiA9PSAwCiAgICAxCiAgZWxzZQogICAgbiAqIGYuY2FsbChuLTEpCiAgZW5kCmVuZAoKcCBhLmNhbGwgNwoKCgpkZWYgcmVjdXJzaW9uICZibG9jawogIGxhbWJkYSBkbyB8Kmh8CiAgICBnID0gbGFtYmRhe3wqaHwgYmxvY2suY2FsbCgqaCAsICZnKX0KICAgIGcuY2FsbCgqaCkKICBlbmQKZW5kCgphID0gcmVjdXJzaW9uIGRvIHxuICwgJnJlY3wKICBpZiBuID09IDAKICAgIDEKICBlbHNlCiAgICBuICogcmVjLmNhbGwobi0xKQogIGVuZAplbmQKcCBhLmNhbGwgNwo=