3.3 Solution for Exercise 13

An expression is represented by a function; a clause containing two expressions can be represented by a pair of functions.

(define-syntax-rule (my-cond-v0 [question-expr answer-expr] ...)
  (my-cond-v0-fun
   (list
    (cons    ; bleh, I know, improper use of cons
     (lambda () question-expr)
     (lambda () answer-expr))
    ...)))
 
(define (my-cond-v0-fun clauses)
  (if (pair? clauses)
      (let ([question-thunk (car (car clauses))]
            [answer-thunk (cdr (car clauses))])
        (if (question-thunk)
            (answer-thunk)
            (my-cond-v0-fun (cdr clauses))))
      (void)))