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