Created
August 30, 2013 09:24
-
-
Save podhmo/6388012 to your computer and use it in GitHub Desktop.
1つの式〜
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
from __future__ import print_function | |
(lambda zero, one, succ, is_zero, pred, AND, IF, Y, undefined: | |
(lambda add, mul, sub: | |
(lambda GT, EQ: | |
(lambda rem, REP: | |
(lambda three, five,num_from_church: | |
(lambda fifteen, one_hundred: | |
(lambda fizzbuzz: | |
fizzbuzz(lambda _: print("fizzbuzz"))(lambda _: print("fizz"))(lambda _: print("buzz"))(lambda n: print(num_from_church(n)))(one)(one_hundred) | |
)((lambda on_fizzbuzz: (lambda on_fizz: (lambda on_buzz: (lambda on_default: (lambda start: (lambda end: REP(lambda n: IF(is_zero(rem(n)(fifteen)))(lambda : on_fizzbuzz(n))(lambda : IF(is_zero(rem(n)(three)))(lambda : on_fizz(n))(lambda : IF(is_zero(rem(n)(five)))(lambda : on_buzz(n))(lambda : on_default(n)))))(undefined)(start)(end)))))))))( | |
mul(three)(five), | |
mul(mul(five)(five))(add(one)(three)), | |
))( | |
succ(succ(one)), | |
succ(succ(succ(succ(one)))), | |
(lambda n: n(lambda x: x+1)(0)), | |
))(Y (lambda rec: (lambda m: (lambda n: (lambda m_: IF(is_zero(m_))(lambda : (EQ(m)(n)(zero)(m)))(lambda : rec(m_)(n)))(sub(m)(n))))), | |
Y (lambda rec: (lambda f: (lambda _: (lambda i: (lambda j: IF(GT(i)(j))(lambda : rec(f)(f(i))(succ(i))(j))(lambda : undefined)))))), | |
))((lambda m: (lambda n: is_zero(sub(m)(n)))), | |
(lambda m: (lambda n: AND(is_zero(sub(n)(m)))(is_zero(sub(n)(m))))) | |
))((lambda m: (lambda n: n(succ)(m))), | |
(lambda m: (lambda n: (lambda f: (lambda x: n(m(f))(x))))), | |
(lambda m: (lambda n: n(pred)(m))), | |
))( | |
(lambda f: (lambda x: x)), | |
(lambda f: (lambda x: f(x))), | |
(lambda n: (lambda f: (lambda x: f(n(f)(x))))), | |
(lambda n: (lambda x: (lambda y: n(lambda z: y)(x)))), | |
(lambda n: (lambda f: (lambda x: n((lambda g : lambda h: h(g(f))))(lambda u: x)(lambda u: u)))), | |
(lambda x: (lambda y: x(y)(x))), | |
(lambda p: (lambda x: (lambda y: p(x)(y)()))), | |
(lambda g: (lambda x: (lambda m: g(x(x))(m)))(lambda x: (lambda m: g(x(x))(m)))), 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment