(define (a-plus-abs-b a b)
(if (> b 0) (+ a b) (- a b))
)
(define (a-plus-abs-b-book a b)
((if (> b 0) + -) a b)
)
(a-plus-abs-b 1 -1)
(a-plus-abs-b-book 1 -1)
if语句返回运算符,这也太灵活了.
时间: 2024-11-09 10:54:36
(define (a-plus-abs-b a b)
(if (> b 0) (+ a b) (- a b))
)
(define (a-plus-abs-b-book a b)
((if (> b 0) + -) a b)
)
(a-plus-abs-b 1 -1)
(a-plus-abs-b-book 1 -1)
if语句返回运算符,这也太灵活了.