{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

10.11 practice-probs

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

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 Document Right 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

  • Fall '07
  • Fisler
  • Madrid Metro, Metropolitana di Napoli, Osaka Municipal Subway, Osaka Loop Line, Montreal Metro, Line 2 Orange

{[ snackBarMessage ]}

Page1 / 3

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

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

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