Welcome to the CHICKEN Scheme pasting service
macro question added by ScaryMonster on Thu Aug 6 00:59:49 2015
(define-syntax s/b (syntax-rules () ((s/b test-expr expected-value) (let ((val test-expr) (exval expected-value) ) (if (equal? val expected-value) (begin (display "s/b ") (display 'test-expr) (display " ... ") (tc-off) (display val) (display " ... ") (tc-off) (display 'expected-value) (tc-off) (newline) #t) (begin (display "s/b ") (display 'test-expr) (display " ...") (newline) (display "...") (display expected-value) (display "...") (newline) (display " ") (display val) (newline) ) ))))) ; example: ; ; ; correct, compared to a static value ; ;> (s/b (+ 3 4) 7) ; s/b (+ 3 4) ... 7 ; ; incorrect, compared to a static value ; ;> (s/b (+ 3 4) 34) ; s/b (+ 3 4) ... ; ...34... ; 12 ; ; correct, compared to a dynamic value ; ;> (s/b (* 7 6) (* 6 7)) ; s/b (* 7 6) ... 42 ... (* 6 7)