lecture8

lecture8 - Class 8: Recursing on Lists Click to edit Master...

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 8: Recursing on Lists 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 DocumentRight Arrow Icon
2/19/10 Menu Quiz Comments List Procedures is-list? (Exercise 5.11) list-sum = list-product, deep-list-sum Generalizing list procedures find-closest Monday: GEB Chapter 5 22
Background image of page 2
2/19/10 Quiz Comments About 2/3 of you have read the GEB reading I really hope everyone reads this! We’ll talk about it in Monday’s class Everyone should know the definition of a List (but only about ½ did) A List is either: null 33 This definition is very important: all of our List procedures depend on it!
Background image of page 3

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

View Full DocumentRight Arrow Icon
2/19/10 Common, Incorrect List Definition A List is a Pair whose second part is either null or a List. 44 If this is our List definition, there is no way to make a list with no elements.
Background image of page 4
2/19/10 Class Pace 55 (write- in)
Background image of page 5

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

View Full DocumentRight Arrow Icon
2/19/10 Book Comments Many people want answers to the exercises (13 people mentioned this) We will do some in class If you ask, I’m happy to provide hints/answers or comments on your answers More diagrams, examples 66
Background image of page 6
2/19/10 is-list? 77 Define a procedure is-list? that takes one input and outputs true if the input is a List, and false otherwise. (is-list? (list 1 2 3)) O true (is-list? (cons 1 (cons 2 null))) l true (is-list? null) ‚ true false (is-list? (cons 1 (cons 2 3))) ( false
Background image of page 7

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

View Full DocumentRight Arrow Icon
is-list?: Easy Way 88 (define is-list? list?)
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.

Page1 / 26

lecture8 - Class 8: Recursing on Lists Click to edit Master...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online