pull/10/head
Matthew Butterick 7 years ago
parent 5a90f14d0c
commit 59a63f71dc

@ -30,7 +30,12 @@
(define-macro (b-func FUNC-ID ARG ...) (define-macro (b-func FUNC-ID ARG ...)
#'(if (procedure? FUNC-ID) #'(if (procedure? FUNC-ID)
(let ([result (FUNC-ID ARG ...)]) (convert-result (FUNC-ID ARG ...))
(raise-line-error
(format "expected ~a to be a function, got ~v"
'FUNC-ID FUNC-ID))))
(define (convert-result result)
(cond (cond
[(number? result) (b-expr result)] [(number? result) (b-expr result)]
[(string? result) result] [(string? result) result]
@ -38,6 +43,3 @@
[else [else
(raise-line-error (raise-line-error
(format "unknown data type: ~v" result))])) (format "unknown data type: ~v" result))]))
(raise-line-error
(format "expected ~a to be a function, got ~v"
'FUNC-ID FUNC-ID))))

Loading…
Cancel
Save