Concrete Abstractions: Chapter 1
Concrete Abstraction: An Introduction to Computer Science using Scheme is a textbook aimed at teaching readers the fundamentals of computer science, programming, and how to think like a computer scientist.
The book is broken into three parts:
- Procedural abstraction
- Data abstraction
- Abstractions of state
You may notice that it covers a lot of the same topics as The Structure and Interpretation of Computer Programs. That is why I am reading it.
I am reading them both concurrently, as a means of better understanding the material and covering it from a variety of angles. I will write summarie of Concrete Abstractions and post them here, just as I am doing for SICP.
What is a Concrete Abstraction?
To quote the authors:
At first glance, the title of this book is an oxymoron. After all, the term abstraction refers to an idea or general description, divorced from physical objects. On the other hand, something is concrete when it is a particular object, perhaps something that you can manipulate with your hands and look at with your eyes. Yet you often deal with concrete abstractions.
The book is an exploration of this idea. How computer the objects of computer science can be created concretely and analysed abstractly. How computer science walks the line between theory and practice, mathematics and engineering.
Because of this, the authors call computer science “the discipline of concrete abstractions.”
Part I: Procedural Abstraction
A procedure is a way of abstracting what’s called a computational process. Roughly speaking, a process is a dynamic succession of events—a happening. When your computer is busy doing something, a process is going on inside it. When we call a process a computational process, we mean that we are ignoring the physical nature of the process and instead focusing on the information content. […] What do computer scientists do with processes? First of all, they write descriptions of them. Such descriptions are often written in a particular programming language and are called procedures. These procedures can then be used to make the processes happen. Procedures can also be analyzed to see if they have been correctly written or to predict how long the corresponding processes will take. This analysis can then be used to improve the performance or accuracy of the procedures.
Chapter 1: Computer Science and Programming
A very simple chapter. Covered programming basics like how to perform simple operations using Scheme:
(+ 4 2) ;; 6
(- 100 5 4 3 2 1) ;; 85
(< 0 1) ;; #t (true)
(even? 123) ;; #f (false)
How to nest expressions and evaluate them conditionally:
(- (* (+ 2 1)
(+ 0 4))
1))
;; 23
(* 100 (if (< (+ 0 1) 2)
(- 3 3)
(+ 4 4)))
;; 0
And how to define - and name - procedures:
(define square
(lambda (x)
(* x x)))
(define tax
(lambda (income)
(if (< income 10000)
0
(* 20/100
(- income 10000)))))