HORINOUCHI Masato
March 26, 2018

# Church Numerals

March 26, 2018

## Transcript

1. ### Church Numerals 2018/03/26 0x64 Tales Reboot #0x0C Lambda Livesense Inc.

OB HORINOUCHI Masato

4. ### νϟʔν਺ͷఆٛ 0 := λf x. x 1 := λf x.

f x 2 := λf x. f (f x) 3 := λf x. f (f (f x)) ↓RubyͰॻ͘ͱ… cn_0 = lambda { |f, x| x } cn_1 = lambda { |f, x| f.call(x) } cn_2 = lambda { |f, x| f.call(f.call(x)) } cn_3 = lambda { |f, x| f.call(f.call(f.call(x))) }
5. ### ޙଓ SUCC := λn f x. f (n f x)

↓RubyͰॻ͘ͱ… succ = lambda { |n| lambda { |f, x| f.call(n.call(f, x)) } }
6. ### Ճࢉ PLUS := λm n f x. m f (n

f x) ↓RubyͰॻ͘ͱ… plus = lambda { |m, n| lambda { |f, x| m.call(f, (n.call(f, x))) } }
7. ### Rubyͷੈք΁ͱม׵ • ͩʔͬͱઆ໌͖͚ͯͨ͠Ͳɺ্هͰఆٛͨؔ͠਺͸νϟʔν਺ (lambda)ͳͷͰ… • RubyωΠςΟϒͷ਺஋දݱʹม׵͍ͯ͋͛ͨ͠ɻ def cn_to_i(cn) cn.call(lambda {

|x| x + 1 }, 0) end

9. ### Next Step ܭࢉػϓϩάϥϜͷߏ଄ͱղऍ (௨শ SICP) MITͷೖ໳ίʔεͰ࢖͏ܭࢉػՊֶͷ༏ ΕͨڭՊॻ ϋϧɾΤΠϒϧιϯ, δΣϦ ʔɾαεϚϯ,

δϡϦʔɾαεϚϯڞஶ(࿨ ాӳҰ༁)ʮܭࢉػϓϩάϥϜͷߏ଄ͱղ ऍ ୈೋ൛ʯ(ϐΞιϯɾΤσϡέʔγϣϯ 2000೥). දࢴͷຐज़ࢣΏ͑ʹͦ͏͍ΘΕ Δ. LISP/Schemeੈքͷ੟యͷͻͱͭ.
10. ### ·ͱΊ • SICP ಡॻձͰνϟʔν਺ΛֶΜͩͱ͖ɺࢀՃऀશһṖͷײಈɻ • ΈΜͳ SICP ಡΜͰͶɻ • Ruby

ͷ Lambda ͸ .call ͠ͳ͍ͱ͍͚ͳ͍ͷͰɺಡΈॻ͖͠ ਏ͍…ɻ