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
170
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
Learning PHP and Static Analysis with PHP Parser
inouehi
1
250
BuefyのMaintainerを引き継いだ件
kikuomax
0
510
生成 AI の中身を覗いてみよう〜基礎から医療現場での応用まで〜
soh9834
2
760
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
490
ISUCONってなんだか難しそう……!!でも、初めてのISUCONにPHPで挑戦してきました!
kotomin_m
1
300
OpenAPI を守るのは難しい
ohmori_yusuke
1
140
Creating Retro-Style Photos Using Swift
ski
1
340
WasmOS: Wasmを実行する自作Microkernel
riru
0
370
Cloud RunとCloud PubSubでサーバレスなデータ基盤2024 with Terraform / Cloud Run and PubSub with Terraform
shinyorke
7
1.9k
Enhancing Applications with Accessibility API
kishikawakatsumi
3
810
マイ隙間家具OSSたちのご紹介
karupanerura
2
150
Laravel標準バリデーションでできること
hmb_ok
2
360
Featured
See All Featured
For a Future-Friendly Web
brad_frost
170
8.9k
Code Reviewing Like a Champion
maltzj
512
39k
Why Our Code Smells
bkeepers
PRO
330
56k
Designing Experiences People Love
moore
135
23k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
11
1.4k
Creatively Recalculating Your Daily Design Routine
revolveconf
209
11k
Robots, Beer and Maslow
schacon
PRO
154
7.9k
Web Components: a chance to create the future
zenorocha
304
41k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
19
1.9k
The Cost Of JavaScript in 2023
addyosmani
13
3.7k
How To Stay Up To Date on Web Technology
chriscoyier
781
250k
Visualization
eitanlees
135
14k
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༵