Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Church Numerals
Search
HORINOUCHI Masato
March 26, 2018
Programming
56
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Church Numerals
社内LT大会 0x64物語Reboot #0x0C Lambda 資料
HORINOUCHI Masato
March 26, 2018
Transcript
11 slides
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 ͠ͳ͍ͱ͍͚ͳ͍ͷͰɺಡΈॻ͖͠ ਏ͍…ɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
More Decks by HORINOUCHI Masato
See All by HORINOUCHI Masato
balenaCloud
thermes
0
130
CPS & CTO
thermes
0
260
FM synthesis
thermes
0
42
A440
thermes
0
73
Inside mml2wav.rb
thermes
0
94
Scheme Interpreter in Ruby
thermes
0
78
Clock / Timer
thermes
0
210
Hash Tree
thermes
0
85
POSIX Threads
thermes
0
60
Other Decks in Programming
See All in Programming
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
270
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
690
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
270
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1k
Spec-driven Development with AI
simas
PRO
0
2.3k
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.6k
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
380
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
340
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
360
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
300
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
160
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Why Our Code Smells
bkeepers
PRO
340
58k
How to Talk to Developers About Accessibility
jct
2
620
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Discover your Explorer Soul
emna__ayadi
2
1.3k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
680
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
480
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
1k
Technical Leadership for Architectural Decision Making
baasie
4
650
Ruling the World: When Life Gets Gamed
codingconduct
0
450
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320