lab10 - CS 61A - Week 10 Solutions LAB ASSIGNMENT: 3.12...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 CS 61A -- Week 10 Solutions LAB ASSIGNMENT: 3.12 append vs. append! exp1 is (b) two pairs that are part of the list x. (You can tell because it uses cons, which is the constructor function that generates a brand new pair.) Append! does not invoke cons the two argument lists. 2. Set! vs. set-cdr! There are two ways to think about this, and you should understand both of them: The syntactic explanation -- SET! is a special form must be a symbol, not a compound expression. So anything of the form (set! (. ..) . ..) must be an error. The semantic explanation -- SET! and SET-CDR! are about two completely different purposes. SET! is about the bindings of variables in an environment. SET-CDR! is about pointers within pairs. SET! has nothing to do with pairs no situation in which they are interchangeable. (Note: The book says, correctly, that the two are *equivalent* in the sense that you can use one to implement the other. But what that means is that, for example, if we didn't have pairs in our language we could
Background image of page 1

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

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

Page1 / 6

lab10 - CS 61A - Week 10 Solutions LAB ASSIGNMENT: 3.12...

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

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