💾 Archived View for gemini.lostleonardo.xyz › sicp › lecture-3B.gmi captured on 2021-12-17 at 13:26:06. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
In order to make a system that is robust, it has to be insensitive to small changes; a small change in the problem should lead to only a small change in the solution.
This is done by creating a language at that level of detail in which the solution to a class of problems is representable. Then, at the level of detail you are working, there is a language in which you can express alternate solutions to various problems of the same type.
A reduction rule is something that is amenable to a recursion based on a case analysis (using "cond") of the parts. Any time we do anything complicated via recursion we need a case anlaysis, that is a conditional of some kind.
A dispath on the type of an expression is absolutely essential in building languages.
JMS defines a set of calculus rules using list structure and comments:
"There is a lot of wishful thinking here. I haven't told you anything about how I am going to make these representations".
"If I want to represent sums and differences and quotients and things like that, why not use the language in which I am writing my program".
"An expression is atomic (as opposed to a list) when it cannot be broken into parts - i.e. it does not have a car and a cdr".
In Lisp, you have two kinds of object - atoms and combinations.
The quotation operator enables Lisp programmers to distinguishe between a symbol and the value to which a symbol is bound.
"Quotation is a very complex concept and adding it to a language causes a great deal of troubles".
Without quotation you can always substitute equals for equals in expressions. But once you introduce quotation, you cannot always substitute equals for equals and expect to get a right answer without being very careful.
"You cannot substitute into referentially opaque contexts and quotation is the prototypical example of an opaque context".
The introduction of an abstraction barrier - the interface procedures - allows the programmer to change the representation (the body of those procedures) without affecting the parts of the program that use those interface procedurs. In short, an abstraction barrier seperates use from representation.
"Quotation is a way of saying this is an expression I am talking about rather than than this expression is talking about something, and I want to talk about that. Quotation stops and says, I am talking about this expression itself".
The key idea is that in order to make a system robust it has to be insensitive to small changes.
The quotation operator is used to disambiguate a precise symbol '+.
Quotation means you are discussing the word not what the word means.
Why are CAR and CDR the names that are used? The names come from the fact that the machine on which Lisp was programmed had an address register and a decrement register.