Result: explain why a program in this language is made of the same lists that a program manipulates, and why that is useful rather than a curiosity.
What you need to know: Reading the Parentheses. Nothing else.
The same shape means two things
You already know this shape.
(+ 2 3)Applied, it produces five. Now put a quote mark in front of it.
'(+ 2 3)That produces a list of three items, the symbol +, the number two, and the number three. Nothing was added or evaluated. The quote says treat this as data rather than as something to do.
The same text is a call or a list depending only on whether you asked for it to run. In most languages a function call and a list of three items are unrelated things that happen to both use punctuation. Here they are one thing seen two ways.
Why that matters in ordinary code
You do not need to be writing a compiler for this to pay off. It shows up the first time a program returns a decision instead of a number.
(define answer '(decision allow))
(list (car answer) (car (cdr answer)))The result is (decision allow). The program built a small piece of structured data using exactly the notation it is written in, and took it apart with ordinary list operations. There was no separate syntax for literals, no serialization format to choose, and no object model to define first.
That is the everyday version of the idea. A program that produces structure produces the same kind of thing it is made of, so the tools for one work on the other.
Quote, and the family around it
Quote has relatives you will meet later.
'x
`x
,x
,@xsThe first is quote, treat as data. The second is quasiquote, treat as data but allow holes. The third fills a hole with a computed value, and the fourth fills a hole by splicing in a list. They exist so a program can build structure that is mostly fixed with a few parts filled in.
You do not need them yet. Knowing they exist prevents surprise when you see a backtick and it is not a string.
The honest caveat
The famous consequence of code being data is that programs can write programs. That is real, and it is also not what most working code does. Most working code benefits in the smaller way shown above, uniform notation and one set of tools.
Treat the grand version as a door that is open rather than a room you must enter.
Try this
Predict both results before running them.
(list (+ 1 2) '(+ 1 2))Show answer
(3 (+ 1 2)). The first element was evaluated and became three. The second was quoted, so it stayed a three item list. The same text, two outcomes, decided entirely by the quote mark.
Ready to move on when
You can say what the quote mark does, give an example of a program returning structured data, and explain why the notation for data and the notation for calls being the same is convenient rather than confusing.
Continue to Data, Conditions, and Decisions, which builds real rules out of exactly these pieces.