内容 2.1 Introduction to Data Abstraction · 73
练习 自检推理
Exercise 2.1: Define a better version of
make-rat that handles both positive and negative arguments.
Make-rat should normalize the sign so that if the rational number is
positive, both the numerator and denominator are positive, and if the rational
number is negative, only the numerator is negative.
练习 2.1:定义 make-rat 的改进版本,使其能正确处理正数和负数参数。make-rat 应对符号进行规范化:若有理数为正,则分子和分母均为正;若有理数为负,则仅分子为负。
我的笔记 自动保存