greghendershott/fear-of-macros

Code mismatch in section 3.4

Halfwake opened this issue · 1 comments

In section 3.4 the 'our-if-v2' code and the step by step breakdown after it don't match up. In the second line of the function 'xs' is defined using 'syntax->list', but in the step by step breakdown 'xs' is defined using 'syntax->datum'. If there's no reason for the change then they should be made the same, and if there is a reason then a footnote explaining why would help clarify.

(define-syntax (our-if-v2 stx)
    (define xs (syntax->list stx)) ;1
    (datum->syntax stx `(cond [,(cadr xs) ,(caddr xs)]
                              [else ,(cadddr xs)])))

(define xs (syntax->datum stx)) ;2

Good catch -- thanks!