内容 2.5 Systems with Generic Operations · 175
练习 自检推理
Exercise 2.83: Suppose you are designing a
generic arithmetic system for dealing with the tower of types shown in
Figure 2.25: integer, rational, real, complex. For each type (except
complex), design a procedure that raises objects of that type one level in the
tower. Show how to install a generic raise operation that will work for
each type (except complex).
练习 2.83:假设你正在设计一个通用算术系统,用于处理图 2.25 所示的类型塔:integer(整数)、rational(有理数)、real(实数)、complex(复数)。对每种类型(complex 除外),设计一个过程,将该类型的对象在塔中提升一个层次。说明如何安装一个通用的 raise 操作,使其适用于每种类型(complex 除外)。
我的笔记 自动保存