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
Shig.Takei
November 03, 2012
Programming
0
180
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
40
Other Decks in Programming
See All in Programming
距離関数を極める! / SESSIONS 2024
gam0022
0
290
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
イベント駆動で成長して委員会
happymana
1
340
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
イマのCSSでできる インタラクション最前線 + CSS最新情報
clockmaker
3
250
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
初めてDefinitelyTypedにPRを出した話
syumai
0
420
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
120
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
flutterkaigi_2024.pdf
kyoheig3
0
150
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
900
Six Lessons from altMBA
skipperchong
27
3.5k
Writing Fast Ruby
sferik
627
61k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Into the Great Unknown - MozCon
thekraken
32
1.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
For a Future-Friendly Web
brad_frost
175
9.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Agile that works and the tools we love
rasmusluckow
327
21k
How GitHub (no longer) Works
holman
310
140k
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༵