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
0
190
Purely Functional Data Structures chap.10.1
Shig.Takei
November 03, 2012
Tweet
Share
More Decks by Shig.Takei
See All by Shig.Takei
How Ethereum Works (備忘録)
shtaag
0
47
Other Decks in Programming
See All in Programming
CSC307 Lecture 08
javiergs
PRO
0
660
AI & Enginnering
codelynx
0
110
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
140
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
AtCoder Conference 2025
shindannin
0
1k
MUSUBIXとは
nahisaho
0
130
dchart: charts from deck markup
ajstarks
3
990
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
160
AgentCoreとHuman in the Loop
har1101
5
220
Data-Centric Kaggle
isax1015
2
760
CSC307 Lecture 01
javiergs
PRO
0
680
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
120
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Crafting Experiences
bethany
1
46
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Navigating Team Friction
lara
192
16k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
110
Paper Plane
katiecoart
PRO
0
46k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
200
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
190
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
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༵