ps07 - CS51 Assignment 7: Object-Oriented Programming Due:...

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

View Full Document Right Arrow Icon
CS51 Assignment 7: Object-Oriented Programming Due: Tue, April 14th, 2009, 11:59PM Total Points: 44 (including 5 style points) 1 Mutable Lists (7 points total) Exercise 1. 7 points In lecture, you learned about creating mutable lists using mcons . A mutable list is not a regular scheme list, and therefore cannot be passed to functions expecting a regular list. These functions must be re-written for mutable lists. As you may have noticed, a call to set! doesn’t seem to evaluate to anything, since nothing is printed by interpreter. > ( define foo 1) > ( set ! foo 2) > ; Nothing was printed ! However, set! does actually evaluate to a value, #<void> , which the interpreter simply chooses not to print. You can make functions you write return <#void> by calling the void function. For example, > ( define foo 1) > ( void ) > ( equal? ( void ) ( set ! foo 2)) # t (a) [5 points] Write map! , which performs a map operation on a mutable list. Calling (map! f lst) will modify the contents of lst such that each element
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.

This note was uploaded on 07/26/2009 for the course COMPUTERSC CS51 taught by Professor Gregmorrisett during the Spring '09 term at Harvard.

Page1 / 3

ps07 - CS51 Assignment 7: Object-Oriented Programming Due:...

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