Skip to main content

No SICP - Chapter 1.1 Review

·309 words·2 mins· loading · loading ·
Thomas
Author
Thomas
Software Engineer, polyglot and I also love sports! Business inquiries to the email attached in my profile.
Table of Contents

I think I never expected to reach this far on my SICP journey. No, I’m not talking about just covering Chapter 1 section 1, but at the time of this writing, I’ve finished Chapter 1 and I’m now starting Chapter 2. I was very tempted to go for SICP’s critique: How to Design Programs (HtDP), but in the end I decided to address my root weaknesses when I tried to dive into the famous wizard book.

Pre-requisites for Chapter 1, Section 1 Elements of Programming
#

If you’re starting this book, then your only pre-requisite will be having a Scheme implementation installed in your machine. Personally, I did not want to go through the hassles of making the official and recommended Scheme implementation (MIT Scheme) work in my machine, as there are some architecture issues when you go through the installation process[1]. Instead, I opted went and installed Racket, a more modern Scheme implementation compatible with the exercises and source code shown in SICP. You can check out Racket here.

Building Abstractions with Procedures
#

Section 1.1
#

The chapter begins by introducing the importance of creating layers of abstractions in order to construct more complex programs, rather than limiting ourselves to using primitives in programming languages all the time. Operations such as adding two numbers involve the use of an operand (which in Scheme, is just another procedure which takes some arguments), and a number a and a number b.

(+ 5 6)
=> 11

(+ 2 2 2 2)

=> 8

(+ 1 2 3 4 5)

=> 15

You can enter any of these into the Scheme REPL (or Racket, by invoking racket in your terminal, or by entering it in the REPL available in DrRacket: Racket’s GUI IDE), and the results will be printed in a newline, after the operations are evaluated.

(to be continued…)