灯下 登录
计算机科学 / SICP / 2.1.4 Extended Exercise: Interval Arithmetic

Exercise 2.7 · 习题

Exercise 2.7: Alyssa’s program is incomplete
because she has not specified the implementation of the interval abstraction.
Here is a definition of the interval constructor:

(define (make-interval a b) (cons a b))

Define selectors upper-bound and lower-bound to complete the

implementation.

练习 2.7:Alyssa 的程序尚不完整,因为她还没有给出区间抽象的实现。以下是区间构造函数的定义:

(define (make-interval a b) (cons a b))

请定义选择函数 upper-bound 和 lower-bound 以完成实现。

Racket #lang sicp
(define (make-interval a b) (cons a b))