10

SICP - "Structure and Interpretation of Computer Programs"

Explanation for the same would be nice

Can some one explain about Metalinguistic Abstraction

yesraaj
  • 46,370
  • 69
  • 194
  • 251
  • http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read the book i am mentioning is in third – yesraaj Dec 10 '08 at 08:48
  • 2
    How the hell do you put a bounty on a subjective question? Especially one that is so closely related to personal experience? – AnonJr Jan 28 '09 at 21:05
  • I was wondering the same thing? – JesperE Jan 28 '09 at 21:52
  • 2
    there were no answers for this question without bounty – yesraaj Jan 29 '09 at 04:00
  • So change the question then. This is like awarding a gold medal to the swimmer with the best personal training story - nice to read, but not worthy of a medal. – AnonJr Jan 29 '09 at 17:02
  • 23 hours to go, you should pick the answer so the bounty doesn't get lost in the system. – Robert Gould Feb 02 '09 at 10:31
  • Stack Overflow is explicitly focused on *narrow* questions about *specific* problems with *objective* answers. SICP is a great book, but this is entirely off-topic here. – Charles Duffy May 16 '19 at 16:22

12 Answers12

22

SICP really drove home the point that it is possible to look at code and data as the same thing.

I understood this before when thinking about universal Turing machines (the input to a UTM is just a representation of a program) or the von Neumann architecture (where a single storage structure holds both code and data), but SICP made the idea much more clear. Scheme (Lisp) helped here, as the syntax for a program is exactly the same as the syntax for lists in general, namely S-expressions.

Once you have the "equivalence" of code and data, suddenly a lot of things become easy. For example, you can write programs that have different evaluation methods (lazy, nondeterministic, etc). Previously, I might have thought that this would require an extension to the programming language; in reality, I can just add it on to the language myself, thus allowing the core language to be minimal. As another example, you can similarly implement an object-oriented framework; again, this is something I might have naively thought would require modifying the language.

Incidentally, one thing I wish SICP had mentioned more: types. Type checking at compilation time is an amazing thing. The SICP implementation of object-oriented programming did not have this benefit.

A. Rex
  • 31,633
  • 21
  • 89
  • 96
  • 3
    Heh… writing in assembly is what made me look at code and data as the same thing. I still miss it, sometimes — rewriting jumps may not have been the most *clear* way to both store and handle program state, but it was certainly *concise*. :-) – Ben Blank Jan 30 '09 at 18:19
9

I didn't read that book yet, I have only looked at the video courses, but it taught me a lot. Functions as first class citizens was mind blowing for me. Executing a "variable" was something very new to me. After watching those videos the way I now see JavaScript and programming in general has greatly changed.

Oh, I think I've lied, the thing that really struck me was that + was a function.

Ionuț G. Stan
  • 176,118
  • 18
  • 189
  • 202
5

The one that I thought was really cool was streams with delayed evaluation. The one about generating primes was something I thought was really neat. Like a "PEZ" dispenser that magically dispenses the next prime in the sequence.

Will Ness
  • 70,110
  • 9
  • 98
  • 181
Jason S
  • 184,598
  • 164
  • 608
  • 970
5

I think the most surprising thing about SICP is to see how few primitives are actually required to make a Turing complete language--almost anything can be built from almost nothing.

Since we are discussing SICP, I'll put in my standard plug for the video lectures at http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/, which are the best Introduction to Computer Science you could hope to get in 20 hours.

Michael Dorfman
  • 4,060
  • 1
  • 22
  • 29
4

One example of "the data and the code are the same thing" from A. Rex's answer got me in a very deep way.

When I was taught Lisp back in Russia, our teachers told us that the language was about lists: car, cdr, cons. What really amazed me was the fact that you don't need those functions at all - you can write your own, given closures. So, Lisp is not about lists after all! That was a big surprise.

3

A concept I was completely unfamiliar with was the idea of coroutines, i.e. having two functions doing complementary work and having the program flow control alternate between them.

lindelof
  • 34,556
  • 31
  • 99
  • 140
2

I was still in high school when I read SICP, and I had focused on the first and second chapters. For me at the time, I liked that you could express all those mathematical ideas in code, and have the computer do most of the dirty work.

When I was tutoring SICP, I got impressed by different aspects. For one, the conundrum that data and code are really the same thing, because code is executable data. The chapter on metalinguistic abstractions is mind-boggling to many and has many take-home messages. The first is that all the rules are arbitrary. This bothers some students, specially those who are physicists at heart. I think the beauty is not in the rules themselves, but in studying the consequence of the rules. A one-line change in code can mean the difference between lexical scoping and dynamic scoping.

Today, though SICP is still fun and insightful to many, I do understand that it's becoming dated. For one, it doesn't teach debugging skills and tools (I include type systems in there), which is essential for working in today's gigantic systems.

namin
  • 37,139
  • 8
  • 58
  • 74
2

I was most surprised of how easy it is to implement languages. That one could write interpreter for Scheme onto a blackboard.

mattiast
  • 1,934
  • 12
  • 18
1

I felt Recursion in different sense after reading some of the chapters of SICP

Vinay
  • 4,743
  • 7
  • 33
  • 43
1

I am right now on Section "Sequences as Conventional Interfaces" and have found the concept of procedures as first class citizens quite fascinating. Also, the application of recursion is something I have never seen in any language.

Sameer
  • 23
  • 1
  • 6
0

Closures.

Coming from a primarily imperative background (Java, C#, etc. -- I only read SICP a year or so ago for the first time, and am re-reading it now), thinking in functional terms was a big revelation for me; it totally changed the way I think about my work today.

Christian Nunciato
  • 10,276
  • 2
  • 35
  • 45
0

I read most part of the book (without exercise). What I have learned is how to abstract the real world at a specific level, and how to implement a language.

Each chapter has ideas surprise me:

The first two chapters show me two ways of abstracting the real world: abstraction with the procedure, and abstraction with data.

Chapter 3 introduces time in the real world. That results in states. We try assignment, which raises problems. Then we try streams.

Chapter 4 is about metalinguistic abstraction, in other words, we implement a new language by constructing an evaluator, which determines the meaning of expressions.

Since the evaluator in Chapter 4 is itself a Lisp program, it inherits the control structure of the underlying Lisp system. So in Chapter 5, we dive into the step-by-step operation of a real computer with the help of an abstract model, register machine.

Thanks.

GraceMeng
  • 949
  • 8
  • 6