CS61A_sp99_mt2 - CS 61A, Spring 1999 Midterm #2 Professor...

Info iconThis preview shows pages 1–2. 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: CS 61A, Spring 1999 Midterm #2 Professor Brian Harvey Question 1 (4 points): What will Scheme print in response to the following expressions? If an expression produces an error message, you may just say "error"; you don't have to provide the exact text of the message. If the value of an expression is a procedure, just say "procedure"; you don't have to show the form in which Scheme prints procedures. Also, draw a box and pointer diagram of the value produced by each expression. (cons '(a b) '(( c d))) (cdadr '((1 2 3) (4 5 6) (7 8 9))) (cons (list '(a) '(b)) (list 'c 'd)) (cons '(a b) 'c) Question 2 (5 points): A three-tree is a tree-like structure in which each node contains two values, called the left-datum and the right-datum , and up to three children, called the left-branch , the middle-branch , and the right-branch . (Any of these can be an empty list instead of a three-tree.) (a) Write the constructor (make-3 lft-dat rt-dat lft-br mid-br rt-br) and the appropriate selectors so that a...
View Full Document

This note was uploaded on 11/23/2010 for the course CS 61A taught by Professor Harvey during the Fall '08 term at University of California, Berkeley.

Page1 / 3

CS61A_sp99_mt2 - CS 61A, Spring 1999 Midterm #2 Professor...

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