lecture7 - H IERARCHICAL D ATA 7 GEORGE WANG...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: H IERARCHICAL D ATA 7 GEORGE WANG [email protected] Department of Electrical Engineering and Computer Sciences University of California, Berkeley June 30, 2010 1 Review/Clarifications from Last Lecture 1.1 As Printed in Scheme So you may have seen the dot in a pair in Scheme. I want you to know what that means. Scheme always will print a pair as a pair of parentesis with a period in between the car and the cdr . However, this would look really ugly in a list, and therefore, whenever you have a dot followed immediately by an open parens, they ’cancel out’, and you’re left with nothing. Thus, everything that is a proper list will print without periods, which is why you may not have seen them before. In other words, if we do (list 1 2 3) , what we should get under normal rules is (1 . (2 . (3 . ()))) , as opposed to (1 2 3) . 1.2 Lists and Sentences RETRACTION. My TA’s have strongly objected to the characterization that was originally here, and so here’s the final word on that. Lists are NOT sentences, and sentences are NOT lists. We should think about sentences as something completely different from lists. Specifically, we should think about sentences as be- ing an ADT (abstract data type) that is implemented using lists, but doesn’t have to be. We should always respect the abstraction barrier between sentences and lists, by using the sentence constructs (sentence, ev- ery, keep, first, butfirst, etc) only on sentences, and using the list constructs (list, car, cdr, cons, append, etc) only on lists. 1 2 Trees 2.1 The Big Idea Trees are a way we have of representing a hierarchy of information. The obvious example are family trees. You have a matriarch and a patriarch followed by all the descendants. Alternately, we may want to orga- nize a series of information geographically. At the very top, we have the world, but below that we have countries, then states, then cities. We can also decompose arithmetic operations into something much the same way.same way....
View Full Document

This note was uploaded on 08/14/2010 for the course EECS 61A taught by Professor Harvey during the Summer '08 term at Berkeley.

Page1 / 5

lecture7 - H IERARCHICAL D ATA 7 GEORGE WANG...

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

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