{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture6 - Class 6 Programmi ng with Data Click to edit...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Click to edit Master subtitle style 2/19/10 Class 6: Programmi ng with Data David Evans cs1120 Fall 2009
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2/19/10 Ways to Design Programs 1. Think about what you want to do , and turn that into code. 1. Think about what you need to represent , and design your code around that. Which is better? 22
Background image of page 2
2/19/10 History of Scheme Scheme [Guy Steele & Gerry Sussman, 1975] Guy Steele co-designed Scheme and created the first Scheme interpreter for his 4th year project More recently, Steele specified Java [1995] “Conniver” [1973] and “Planner” [1967] Based on LISP [John McCarthy, 1958] 33
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2/19/10 LISP L ots of I nsipid S illy P arentheses” Lists are pretty important – hard to write a useful Scheme program without them. 44
Background image of page 4
2/19/10 Making Lists 55
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2/19/10 Making a Pair > ( cons 1 2) (1 . 2) cons cons tructs a pair 1 2 66
Background image of page 6
2/19/10 Splitting a Pair > ( car ( cons 1 2)) 1 > ( cdr ( cons 1 2)) 2 car extracts first part of a pair cdr extracts second part of a pair 1 2 car cdr 77
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2/19/10 Pair Examples 88 > ( cons ( cons 1 2) 3)) ((1 . 2) 3) > ( cdr ( car ( cons ( cons 1 2) 3))) 2 > ( car ( car ( cons 1 ( cons 2 3)))) car: expects argument of type <pair>; given 1
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}