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
HORINOUCHI Masato
March 26, 2018
Programming
55
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
More Decks by HORINOUCHI Masato
See All by HORINOUCHI Masato
balenaCloud
thermes
0
110
CPS & CTO
thermes
0
250
FM synthesis
thermes
0
41
A440
thermes
0
67
Inside mml2wav.rb
thermes
0
93
Scheme Interpreter in Ruby
thermes
0
76
Clock / Timer
thermes
0
190
Hash Tree
thermes
0
83
POSIX Threads
thermes
0
59
Other Decks in Programming
See All in Programming
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.8k
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
680
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
150
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.9k
不幸な GC
chencmd
0
880
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.7k
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
470
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
XHTMLが残したもの
yosuke_furukawa
PRO
1
410
バグを直したら useEffect が消えた
colorful12
3
840
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
Featured
See All Featured
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
450
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
RailsConf 2023
tenderlove
30
1.5k
4 Signs Your Business is Dying
shpigford
187
23k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
The browser strikes back
jonoalderson
0
1.6k
Design in an AI World
tapps
1
300
Designing for Performance
lara
611
70k
How to train your dragon (web standard)
notwaldorf
97
6.8k
First, design no harm
axbom
PRO
2
1.3k
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 ͠ͳ͍ͱ͍͚ͳ͍ͷͰɺಡΈॻ͖͠ ਏ͍…ɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠