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

@ -30,14 +30,16 @@
(define-macro (b-func FUNC-ID ARG ...)
#'(if (procedure? FUNC-ID)
(let ([result (FUNC-ID ARG ...)])
(cond
[(number? result) (b-expr result)]
[(string? result) result]
[(boolean? result) (if result 1 0)]
[else
(raise-line-error
(format "unknown data type: ~v" result))]))
(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
[(number? result) (b-expr result)]
[(string? result) result]
[(boolean? result) (if result 1 0)]
[else
(raise-line-error
(format "unknown data type: ~v" result))]))
Loading…
Cancel
Save