Motivation Patternology Applications Implementation Pla i d: Pattern Language for Abstract Datatypes Austin Clements Irene Zhang Dan Ports Friday, May 11, 2007 Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Syntax Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Syntax Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) ( define ( crash − computer comp) ( cond (( match comp ’( ∗ computer ∗ windows )) ’ done ) (( match comp ’( ∗ computer ∗ l i n u x )) ’ f a i l e d ) ) ) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Syntax Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) Abstraction ( define ( crash − computer comp) ( cond (( match comp ’( ∗ computer ∗ windows )) Violation ’ done ) (( match comp ’( ∗ computer ∗ l i n u x )) ’ f a i l e d ) ) ) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Syntax Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) Abstraction ( define ( crash − computer comp) ( cond (( match comp ’( ∗ computer ∗ windows )) Violation ’ done ) (( match comp ’( ∗ computer ∗ l i n u x )) ’ f a i l e d ) ) ) Syntax patterns are limited to built-in types. Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Syntax Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) ( define ( crash − computer comp) ( cond (( match comp ’( make − computer ’ windows )) ’ done ) (( match comp ’( make − computer ’ l i n u x )) ’ f a i l e d ) ) ) Syntax patterns are limited to built-in types. Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation Semantic Patterns and ADT’s ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) ( d e f i n e ( computer? datum ) ( d e f i n e ( match : make − computer? p a t t e r n ) ( and ( p a i r ? datum ) ( and ( p a i r ? p a t t e r n ) ( eq? ( car datum ) ’ ∗ computer ∗ ) ) ) ( eq? ( car p a t t e r n ) ’ make − computer ) ) ) ( d e f i n e computer − model t h i r d ) ( d e f i n e match : make − computer − model second ) ( d e f i n e computer − os second ) ( d e f i n e match : make − computer − os t h i r d ) ( d e f i n e ( match : make − computer model − comb os − comb) ( d e f i n e ( match data d i c t i o n a r y succeed ) ( and ( computer? data ) (model − comb ( computer − model data ) d i c t i o n a r y ( lambda ( new − dict n ) (os − comb ( computer − os data ) new − dict succeed ) ) ) ) ) match ) ( d e f i n e ( compile − match − make − computer pat use − env loop ) ‘( match : make − computer ,( loop ( match : make − computer − model pat )) ,( loop ( match : make − computer − os pat ) ) ) ) ( eq − put! ’ make − computer ’ pattern − keyword compile − match − make − computer ) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation (match comp ’(make − computer ’windows)) We want to be able to write this Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Patternology Applications Implementation ( d e f i n e ( computer? datum ) ( d e f i n e ( match : make − computer? p a t t e r n ) ( and ( p a i r ? datum ) ( and ( p a i r ? p a t t e r n ) ( eq? ( car datum ) ’ ∗ computer ∗ ) ) ) ( eq? ( car p a t t e r n ) ’ make − computer ) ) ) ( d e f i n e computer − model t h i r d ) ( d e f i n e match : make − computer − model second ) ( d e f i n e computer − os second ) ( d e f i n e match : make − computer − os t h i r d ) ( d e f i n e ( match : make − computer model − comb os − comb) ( d e f i n e ( match data d i c t i o n a r y succeed ) ( and ( computer? data ) (model − comb ( computer − model data ) d i c t i o n a r y ( lambda ( new − dict n ) (os − comb ( computer − os data ) new − dict succeed ) ) ) ) ) match ) ( d e f i n e ( compile − match − make − computer pat use − env loop ) ‘( match : make − computer ,( loop ( match : make − computer − model pat )) ,( loop ( match : make − computer − os pat ) ) ) ) ( eq − put! ’ make − computer ’ pattern − keyword compile − match − make − computer ) Without having to write this Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns 1 Motivation 2 Patternology Constructor-Oriented Pattern Syntax Abstraction, Abstraction, Abstraction Embedding Patterns in Scheme Pro-Choice Patterns 3 Applications 4 Implementation Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 (? x)) (cons 1 (cons x ())) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 . ((? x) . ())) (cons 1 (cons x ())) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 . ((? x) . ())) (cons 1 (cons x ())) Literals Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 . ((? x) . ())) (cons 1 (cons x ())) Literals Pattern variables Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 . ((? x) . ())) (cons 1 (cons x ())) Literals Pattern variables Implicit Deconstructors Explicit Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Constructor-Oriented Pattern Syntax Data-oriented Constructor-oriented Resembles data Resembles code (1 . ((? x) . ())) (cons 1 (cons x ())) Literals Pattern variables Implicit Deconstructors Explicit Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Abstraction, Abstraction, Abstraction ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Motivation Constructor-Oriented Pattern Syntax Patternology Abstraction, Abstraction, Abstraction Applications Embedding Patterns in Scheme Implementation Pro-Choice Patterns Abstraction, Abstraction, Abstraction ( define ( make − computer model os ) ( l i s t ’ ∗ computer ∗ os model )) Pattern Datum (make − computer ’linux) ( ∗ computer ∗ linux pc) Austin Clements, Irene Zhang, Dan Ports Pla i d: Pattern Language for Abstract Datatypes
Recommend
More recommend