tags:

views:

1845

answers:

12

SICP - "Structure and Interpretation of Computer Programs"

Explanation for the same would be nice

Can some one explain about Metalinguistic Abstraction

+6  A: 

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
what video courses? Have a link?
Robert Gould
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/great material!
Ionuț G. Stan
+1: + is a function.
romandas
+2  A: 

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
+13  A: 

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
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
+4  A: 

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.

Jason S
+3  A: 

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.

Arkadiy
I loved that realization, too.
A. Rex
+3  A: 

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
+2  A: 

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
A: 

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

Vinay
A: 

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
A: 

I read the free book and viewed videos Frankly speaking, nothing earth moving in there. May be because i've probably read dozens of book before that.

Vardhan Varma
+1  A: 

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

mattiast
+1  A: 

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