PLQ #12Done on:   Tuesday, April 19th

Question 1 @ 2022-04-19 18:15

What is wrong with the following macro?

(define-syntax-rule (while condition body ...)
  (when condition
    body ...
    (while condition body ...)))

Question 2 @ 2022-04-19 18:18

Given the following definition of xor:

(define-syntax-rule (xor <expr1> <expr2>)
  (let ([temp1 <expr1>]
        [temp2 <expr2>])
    (or (and temp1 (not temp2))
        (and temp2 (not temp1)))))

what would the result be of the following:

(let ([and 1])
  (xor #t #f))

Question 3 @ 2022-04-19 18:21

Last week, we had a quick introduction to types and type systems. Which of the following is FALSE about types/type systems?


Question 4 @ 2022-04-19 18:23

What are the advantages of using macros for syntactic transformations as opposed to primitive functions?