Write summary chapter 2

main
Felix Martin 2021-01-26 13:58:02 -05:00
parent 1d0227f445
commit 231b4ce6c8
1 changed files with 41 additions and 0 deletions

View File

@ -69,8 +69,49 @@ that take other procedures as arguments.
# Chapter 2
Chapter 2 starts by introducing compound data structures to represent pairs and
rational numbers. Abstraction barriers allow implementing procedures on data
types independent of the underlying representation. For example, we could reduce
a rational-number to its lowest denominator at creation or display time. The
book introduces interval arithmetic to deepen the understanding of data
abstractions.
Next, the book shows how to create more complex data structures such as lists
and trees from cons. Higher-order procedures such as map and fold operate on
these structures, for example, to update each element or to aggregate data.
The book then expands on the idea of higher-order procedures by introducing a
picture language as shown in the following image. We can manipulate a painter
with different transformations to create more complex images. The book does not
present a way to paint to the screen, so I have implemented the painter to
create a Python script that can then draw the images via the PIL library.
![Corner Split](misc/corner-split-3.png)
The next section introduces symbolic data that we utilize to implement a system
for symbolic differentiation. One of my favorite things about the book is that
it references concepts from other disciplines, such as calculus. I am happy that
my high school knowledge of these topics is still present enough for me to work
through the exercises.
Next, we explore sets and different ways to present them. The section finishes
with the implementation of Huffman Encoding trees.
The rest of this chapter shows how to implement an algebra system utilizing a
data-directed programming style. We create packages for different types of
numbers, such as rational, complex, and imaginary numbers. We install methods
for all basic algebraic operations, and the functions dispatch the correct
procedure depending on the data type.
Over the next sections and many exercises, we expand the system to automatically
simplify the numbers by creating a hierarchy of data types. Eventually, we
extend the system to support polynomials and even rational polynomials by
extending our previous rational numbers implementation.
I found these exercises challenging but incredibly rewarding. The algebra system
was the point where I gave up when I worked through the book initially, so I
felt a sense of accomplishment when I finished it on my second attempt.
# Chapter 3