Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 26: Printing and Stuff.

Similar presentations


Presentation on theme: "CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 26: Printing and Stuff."— Presentation transcript:

1 CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis colleenL@berkeley.edu Lecture 26: Printing and Stuff

2 Today cons reverse

3 cons Takes two arguments Makes the first arg. the car of the new list Makes the second arg. the cdr of the new list The second argument MUST be a list

4 reverse – car / cdr recursion WRONG (define (reverse lst) (if (null? lst) '() (cons (reverse (cdr lst)) (car lst)) ))

5 (cons (reverse ‘(b c d)) a) (cons (cons (reverse ‘(c d)) b) a) (cons (cons (cons (reverse ‘(d)) c) b) a) (cons (cons (cons (cons (reverse ‘() d) c) b) a) (reverse ‘(a b c d) (cons (cons (cons (cons‘() d) c) b) a) (define (reverse lst) (if (null? lst) '() (cons (reverse (cdr lst)) (car lst)) ))

6 Lectures in the next few days Recursive lambdas Generalized lists (and higher order procedures) Python game development libraries Writing an executable program Tree recursion Graphics Universal register machines Lists Lambdas Association List 61a 61b 61c 170 172 Object oriented programming More practice programs Meta circular evaluatation Internships Interviewing Job market What it like to work as a programmer What you do with CS that’s not programming Sca


Download ppt "CS3L: Introduction to Symbolic Programming Summer 2008Colleen Lewis Lecture 26: Printing and Stuff."

Similar presentations


Ads by Google