灯下 登录
计算机科学 / SICP / 1.1.6 Conditional Expressions and Predicates

Exercise 1.4 · 习题

Exercise 1.4: Observe that our model of
evaluation allows for combinations whose operators are compound expressions.
Use this observation to describe the behavior of the following procedure:

(define (a-plus-abs-b a b)

((if (> b 0) + -) a b))

练习 1.4:观察到我们的求值模型允许运算符是复合表达式的组合式。利用这一观察,描述以下过程的行为:

(define (a-plus-abs-b a b)
((if (> b 0) + -) a b))

Racket #lang sicp
(define (a-plus-abs-b a b)
 ((if (> b 0) + -) a b))