摘要:
从 2.83 开始我感觉做的有点怪怪的,我似乎没有很好地理解这些题目的目的,也没有在写完之后用测试样例监测,只是简单的实现了那个逻辑。所以做到练习 2.85 我已经不知道在干什么了,所以我决定重新写一遍,把实数这一层也加上,同时每道题目新增的过程都要有对应的测试样例。 结果写了两天也没写出来,参考别 阅读全文
从 2.83 开始我感觉做的有点怪怪的,我似乎没有很好地理解这些题目的目的,也没有在写完之后用测试样例监测,只是简单的实现了那个逻辑。所以做到练习 2.85 我已经不知道在干什么了,所以我决定重新写一遍,把实数这一层也加上,同时每道题目新增的过程都要有对应的测试样例。 结果写了两天也没写出来,参考别 阅读全文
posted @ 2024-11-23 14:07
再思即可
阅读(241)
评论(0)
推荐(0)

Exercise 2.84 Using the raise operation of Exercise 2.83, modify the apply-generic procedure so that it coerces its arguments to have the same type by
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,
Exercise 2.82 Show how to generalize apply-generic to handle coercion in the general case of multiple arguments. One strategy is to attempt to coerce
Exercise2.81 Louis Reasoner has noticed that apply-generic may try to coerce the arguments to each other’s type even if they already have the same typ
Exercise 2.80 Define a generic predicate =zero? that tests if its argument is zero, and install it in the generic arithmetic package. This operation s
Exercise2.79 Define a generic equality predicate equ? that tests the equality of two numbers, and install it in the generic arithmetic package. This o
Exercise2.78 The internal procedures in the scheme-number package are essentially nothing more than calls to the primitive procedures +, -, etc. It wa
Exercise 2.77 Louis Reasoner tries to evaluate the expression (magnitude z) where z is the object shown in Figure 2.24. To his surprise, instead of th
Exercise 2.76 As a large system with generic operations evolves, new types of data objects or new operations may be needed. For each of the three stra
浙公网安备 33010602011771号