《SICP》读书笔记--Chapter 2 Building Abstraction with Data
2015-09-30 17:14
621 查看
Chapter 2 Building Abstraction with Data
compound data object
data abstraction: isolating the parts of a program that deal with how data objects are used
key points: closure, conventional interface
2.1 Introduction to Data Abstraction
Procedure Abstraction: separate the way the procedure would be used from the details of how the procedure would be implemented in terms of more primitive procedures.
Data Abstraction: isolate how a compound data object is used from the details of how it is constructed from more primitive data objects.
Selectors / Constructors
2.1.1 Arithmetic Operations for Rational Numbers
Pairs
cons car cdr
2.1.2 Abstraction Barriers
--- Programs that use rational numbers ---
Rational numbers in problem domain
--- add-rat, sub-rat ... ---
Rational numbers as numerators and denominators
--- make-rat numer demom ---
Rational numbers as pairs
--- cons car cdr ---
2.1.3 What Is Meant by Data?
Data: defined by some collection of selectors and constructors, together with specified conditions that these procedures must fulfill in order to be a valid representation.
example:
x = make-rat(n, d)
(number x)/(denom x) = n/d
Procedural presentation of data play a central role in our programming repertoire. This style of programming is often called message passing.
2.1.4 Extended Exercise: Interval Arithmetic
2.2 Hierarchical Data and the Closure Property
Closure Property of cons: an operation for combining data objects satisfies the closure property if the results of combining things with that operation can themselves be combined using the same operation.
2.2.1 Representing Sequences
2.2.2 Hierarchical Structures
2.2.3 Sequences as Conventional Interfaces
Modular construction is a powerful strategy for controlling complexity in engineering design
enumerate / filter / map / accumulate
2.2.4 Example: An picture language
2.3 Symbolic Data
... ...
2.4.3 Data-Directed Programming and Additivity
dispatch on type: check the type of a datum and calling an appropriate procedure. problem: must know about all the different representations.
data-directed programming
compound data object
data abstraction: isolating the parts of a program that deal with how data objects are used
key points: closure, conventional interface
2.1 Introduction to Data Abstraction
Procedure Abstraction: separate the way the procedure would be used from the details of how the procedure would be implemented in terms of more primitive procedures.
Data Abstraction: isolate how a compound data object is used from the details of how it is constructed from more primitive data objects.
Selectors / Constructors
2.1.1 Arithmetic Operations for Rational Numbers
Pairs
cons car cdr
2.1.2 Abstraction Barriers
--- Programs that use rational numbers ---
Rational numbers in problem domain
--- add-rat, sub-rat ... ---
Rational numbers as numerators and denominators
--- make-rat numer demom ---
Rational numbers as pairs
--- cons car cdr ---
2.1.3 What Is Meant by Data?
Data: defined by some collection of selectors and constructors, together with specified conditions that these procedures must fulfill in order to be a valid representation.
example:
x = make-rat(n, d)
(number x)/(denom x) = n/d
Procedural presentation of data play a central role in our programming repertoire. This style of programming is often called message passing.
2.1.4 Extended Exercise: Interval Arithmetic
2.2 Hierarchical Data and the Closure Property
Closure Property of cons: an operation for combining data objects satisfies the closure property if the results of combining things with that operation can themselves be combined using the same operation.
2.2.1 Representing Sequences
2.2.2 Hierarchical Structures
2.2.3 Sequences as Conventional Interfaces
Modular construction is a powerful strategy for controlling complexity in engineering design
enumerate / filter / map / accumulate
2.2.4 Example: An picture language
2.3 Symbolic Data
... ...
2.4.3 Data-Directed Programming and Additivity
dispatch on type: check the type of a datum and calling an appropriate procedure. problem: must know about all the different representations.
data-directed programming
相关文章推荐
- 用环境模型来理解javascript中的闭包
- 对嵌套映射的理解
- SICP Exercise 1.13
- sicp习题答案和范例代码 - 第一章
- sicp习题答案和范例代码 - 第二章 2.1
- SICP第一章——构造过程抽象之程序设计的基本元素(1.1)笔记及习题解答
- SICP-《计算机程序的构造和解释》之习题分析与收获——练习1.30
- SICP-《计算机程序的构造和解释》之习题分析与收获——练习1.29
- 游走于数据与代码之间
- 换零钱问题迭代解法
- Structure and Interpretation of Computer Programs 读书笔记
- 应用序和正则序
- [SICP Notes] 1.1 The Elements of Programming
- 【Structure and interpretation of Computer Programs 】学习记录兼导言
- 第一章笔记整理
- SICP-练习2.34
- SICP-练习2.17
- 计算斐波纳契数,分析算法复杂度
- SICP-求幂
- SICP-换零钱方法的统计