Every self-respecting blogger should write about Lisp at least once. So, there is my take.
There is a nice quote, I don't remember of whom - All models are wrong, but some are useful. They are over-simplifications, but they help us think more clearly. Lets make one simple model.
What is an idea? The word "idea" is the name for some representation I hold in my mind. It is linked with a cloud of other words, with some visualizations, some memorized sentences and some non-verbal feelings. (just a different types of storage with different encoding). When I hear or see the word "idea", this is the meaning I have.
The meaning is an inner representation, encoded as a compound expression, a composite object of the mind. The word is just one of many symbolic pointers, a tag, a label, an anchor for this mental object.
There are several such meanings for each word. They can be fetched from the storage, depending on the context, the current state of the mind, the current mental environment. It is like using different dictionaries to look up the meaning of a word.
A word points to a slot in a look-up table - the context. It provides the addresses in a storage for each slot.
It is a huge over-simplification, but it is very useful one.
For example, what is recursion? It is the word of English language, which is the name for the idea of recursion. Each person on earth have his own inner representation of what it is for him. Well, some people have not. The word have no meaning for them, it is not associated with any inner representation. They have no idea.
Depending on the context it could be a mathematical definition, or an idea from computer science, or even a some feeling of being puzzled.
So, what is a word? It is a symbol which points to a chain of associations - its meaning. What is an context? It is a look-up table in between, filled with the pointers to the meaning of symbols. The storage remain unchanged, it is the contexts that change.
So, the same construction of the language, which describes a person, could have two completely different meanings, depending on the context currently present in my mind:
((The young girl) I have seen esterday).
Depending on context, it could be:
- a cute high-school gal I saw on a street last morning.
- my girlfriend, ten year younger, with whom I spent saturday night.
Now, what is Lisp?
Lisp is a language to represent any knowledge stored in our mind, according to this simple model - the chains (actually graphs) of named and unnamed inner representations, verbal and non-verbal.
It uses a list-structure to encode the graphs of associations as a sequence. It is the way to represent a many-dimensional hierarchical data as an one-dimensional ordered sequence.
Any kind of objects could be made out of lists. In particular there is a special kind of objects called closure which represents a piece of encoded knowledge - a procedure along with its data and its context - nested environments where the meaning of all symbols can be found.
Closures are kind of inner representations of the pieces of knowledge inside of a lisp process. They could be manipulated by procedures as data objects, or could be parts of any kind of Lisp expressions.
This provides almost unlimited power to express any idea, comparable with any Natural language. There is no distinction between code and data, between nouns and verbs. One can mix everything to produce any kind of expressions he wishes.