UNB/ CS/ David Bremner/ teaching/ cs4613/ lectures/ lecture05/ strict-if2.rkt
#lang racket
(require [only-in plait test test/exn error print-only-errors])

(define-syntax strict-if
  (syntax-rules ()
    [(strict-if C T E)
     (if (boolean? C)
         (if C T E)
         (error 'strict-if "expected a boolean"))]))

(test (strict-if true 1 (/ 1 0)) 1)
(test/exn (strict-if 0 1 (/ 1 0)) "expected a boolean")