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
Purely Functional Data Structures chap.10.1
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Shig.Takei
November 03, 2012
Programming
190
0
Share
Purely Functional Data Structures chap.10.1
Shig.Takei
November 03, 2012
More Decks by Shig.Takei
See All by Shig.Takei
How Ethereum Works (備忘録)
shtaag
0
52
Other Decks in Programming
See All in Programming
CSC307 Lecture 17
javiergs
PRO
0
310
New "Type" system on PicoRuby
pocke
1
450
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
120
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
830
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
200
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
3.6k
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
150
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
340
AIとRubyの静的型付け
ukin0k0
0
530
net-httpのHTTP/2対応について
naruse
0
430
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
3.5M
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
360
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Documentation Writing (for coders)
carmenintech
77
5.4k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
190
YesSQL, Process and Tooling at Scale
rocio
174
15k
Transcript
Purely Functional Data Structures chap.10.1 Structural Decomposition @shtaag 201211݄3༵
Data-Structural Bootstrappingͷ 201211݄3༵
ͱΓ͋͑ͣ͜Μͳͷ ʢStructural Decompositionͷྫʣ data Seq a = NIL | CONS’
a (Seq (a , a)) 201211݄3༵
ͱΓ͋͑ͣ͜Μͳͷ ʢStructural Decompositionͷྫʣ data Seq a = NIL | CONS’
a (Seq (a , a)) ܕaͷSeq͕ͩͬͨͣ ܕ(a,a)ʹมΘͬͯΔʂ 201211݄3༵
CONS’ a (Seq (a, a)) CONS’ (a, a) (Seq ((a,
a), (a, a)) CONS’ ((a, a), (a, a)) (Seq (((a, a), (a, a)), ((a, a), (a, a))) CONS’ (((a, a), (a, a)), ((a, a), (a, a))) (Seq ((((a, a), (a, a)), ((a, a), (a, a))), (((a, a), (a, a)), ((a, a), (a, a)))) Polymorphic Recursion 201211݄3༵
ҎԼɺ༻ޠ 201211݄3༵
BootStrapping bootstrapping a complete solution from an incomplete solution 201211݄3༵
structural decomposition incompleteͳσʔλߏ͔Β completeͳͷΛbootstrap structural abstraction inefficientͳσʔλߏ͔Β efficientͳߏΛbootstrap 201211݄3༵
uniform recursion data List a = NIL | CONS a
(List a) non-uniform recursion data Seq a = NIL | CONS’ a (Seq (a , a)) 201211݄3༵
Կ͕خ͍͠ʁ ܕͰߏΛറΔ͜ͱͰΞϧΰϦζϜ͕͔Γ͘͢ ͳΔ ઌఔͷseqϊʔυཁૉΛ2ͭ࣋ͭ͜ͱΛอূ ͍ͯ͠Δ sizeS (CONS’ (x, ps)) =
1 + 2 * sizeS ps 201211݄3༵