10.11 practice-probs

10.11 practice-probs - 1. what does a macro do? 2. when...

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: 1. what does a macro do? 2. when should you use a macro? ------------------------------------------------------------------------ 3. The let construct in Scheme is really a macro that creates a lambda and calls it. For example (let [(x 4) (y 5)] (+ x y)) Turns into ((lambda (x y) (+ x y)) 4 5) Write the let macro (call it mylet, since Scheme will complain if you reuse the name). You should be able to handle any number of variables (but at least one). ------------------------------------------------------------------------ 4. (another old exam question) We have been using cond all semester to write conditionals. Most languages include an if-statement for conditionals with only two cases. The expression (if test then-stmt else-stmt) should run the test, performing the then-stmt if the test returns true, otherwise performing the else-stmt. In this question, we want to implement such a construct....
View Full Document

This note was uploaded on 02/06/2008 for the course CS 1102 taught by Professor Fisler during the Fall '07 term at WPI.

Page1 / 3

10.11 practice-probs - 1. what does a macro do? 2. when...

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