Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Church Numerals
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
HORINOUCHI Masato
March 26, 2018
Programming
0
49
Church Numerals
社内LT大会 0x64物語Reboot #0x0C Lambda 資料
HORINOUCHI Masato
March 26, 2018
Tweet
Share
More Decks by HORINOUCHI Masato
See All by HORINOUCHI Masato
balenaCloud
thermes
0
76
CPS & CTO
thermes
0
250
FM synthesis
thermes
0
37
A440
thermes
0
62
Inside mml2wav.rb
thermes
0
86
Scheme Interpreter in Ruby
thermes
0
70
Clock / Timer
thermes
0
160
Hash Tree
thermes
0
76
POSIX Threads
thermes
0
56
Other Decks in Programming
See All in Programming
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
140
Windows on Ryzen and I
seosoft
0
350
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
900
安いハードウェアでVulkan
fadis
0
740
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.3k
PHP 7.4でもOpenTelemetryゼロコード計装がしたい! / PHPerKaigi 2026
arthur1
1
380
S3ストレージクラスの「見える」「ある」「使える」は全部違う ─ 体験から見た、仕様の深淵を覗く
ya_ma23
0
890
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
180
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
1.1k
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
Rethinking API Platform Filters
vinceamstoutz
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
920
Featured
See All Featured
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
Abbi's Birthday
coloredviolet
2
5.6k
Exploring anti-patterns in Rails
aemeredith
2
290
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
180
Done Done
chrislema
186
16k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
480
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.8k
Transcript
Church Numerals 2018/03/26 0x64 Tales Reboot #0x0C Lambda Livesense Inc.
OB HORINOUCHI Masato
νϟʔνͱ • ࣗવΛϥϜμࣜͰදݱ͢Δํ๏ͷͻͱͭ • ؔͰΛද͍ͯ͠Δ
ϥϜμܭࢉ • ϥϜμܭࢉͰ 2 + 3 = 5 Λܭࢉͯ͠ΈΑ͏
νϟʔνͷఆٛ 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))) }
ޙଓ SUCC := λn f x. f (n f x)
↓RubyͰॻ͘ͱ… succ = lambda { |n| lambda { |f, x| f.call(n.call(f, x)) } }
Ճࢉ 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))) } }
Rubyͷੈքͱม • ͩʔͬͱઆ໌͖͚ͯͨ͠Ͳɺ্هͰఆٛͨؔ͠νϟʔν (lambda)ͳͷͰ… • RubyωΠςΟϒͷදݱʹม͍ͯ͋͛ͨ͠ɻ def cn_to_i(cn) cn.call(lambda {
|x| x + 1 }, 0) end
σϞ
Next Step ܭࢉػϓϩάϥϜͷߏͱղऍ (௨শ SICP) MITͷೖίʔεͰ͏ܭࢉػՊֶͷ༏ ΕͨڭՊॻ ϋϧɾΤΠϒϧιϯ, δΣϦ ʔɾαεϚϯ,
δϡϦʔɾαεϚϯڞஶ( ాӳҰ༁)ʮܭࢉػϓϩάϥϜͷߏͱղ ऍ ୈೋ൛ʯ(ϐΞιϯɾΤσϡέʔγϣϯ 2000). දࢴͷຐज़ࢣΏ͑ʹͦ͏͍ΘΕ Δ. LISP/Schemeੈքͷయͷͻͱͭ.
·ͱΊ • SICP ಡॻձͰνϟʔνΛֶΜͩͱ͖ɺࢀՃऀશһṖͷײಈɻ • ΈΜͳ SICP ಡΜͰͶɻ • Ruby
ͷ Lambda .call ͠ͳ͍ͱ͍͚ͳ͍ͷͰɺಡΈॻ͖͠ ਏ͍…ɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠