1 / 6

CS3L: Introduction to Symbolic Programming

CS3L: Introduction to Symbolic Programming. Summer 2008 Colleen Lewis colleenL@berkeley.edu. Lecture 26: Printing and Stuff. Today. cons reverse. cons. Takes two arguments Makes the first arg. the car of the new list Makes the second arg. the cdr of the new list

tfane
Download Presentation

CS3L: Introduction to Symbolic Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS3L: Introduction to Symbolic Programming Summer 2008 Colleen 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 recursionWRONG (define (reverse lst) (if (null? lst) '() (cons (reverse (cdr lst)) (car lst)) ))

  5. (reverse ‘(a b c d) (cons (cons (reverse ‘(c d)) b) a) (cons (reverse ‘(b c d)) a) (cons (cons (cons (reverse ‘(d)) c) b) a) (cons (cons (cons (cons (reverse ‘() d) c) b) a) (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

More Related