# Symbols

A language is a medium for expressing ideas. It is mere a way to encode them, to transform an abstract idea into bits of information, using some set rules, producing a set of expressions.

For now, everything is a symbol. Deep down inside computer symbols are numbers.

3

It is an expression of a *digit* 3. Digit is a concept, a construction of the mind. This expression is a representation of that concept.

256

It is an expression of *number* 256. it consists of 3 digits - 2, 5 and 6. Each digit corresponds to a different xxx. That means we combine a several digits together to represent a number bigger than 10.

Using only 10 digits (from 0 to 9) we can represent an infinite number by just combining digits together.

'a'

It is a character - a symbol with which we are taught to represent the vowel 'a' - a distinct phoneme of English language.

We use quotes to make it clear, that it is a representation of a character a. Not an article.

It is kind of awkward to try to describe an encoding system using another, more general encoding system, but it is a way to realize that everything is almost the same within different layers of abstraction.)

'+'

This is yet another symbol. In English we call it "plus", and use it to represent an *operation* of adding two numbers together.

"cat"

This expression is a *compound symbol*. It consists of three characters - 'c', 'a', and 't'. Together they form a *word* 'cat' which corresponds to that sound we used to produce when we see that small, cute animal.

We use double quotes to clarify that this sequence of characters is a representation of a particular word.

"The cat sat on the mat."

This expression is a string of symbols. Together they form a sentence or an expression in the English language. We use double quotes to show the boundaries of the expression.

1 + 2

Is a *compound expression*. It consists of three different symbols - two digits and symbol "plus".

Each one of these is an expression, but an expression of different kind. People are used to say that there are different types of expressions, or that there are expression of different types. For us, for now, they all are symbols (which are just numbers, which, in turn, are sequences of bits). It from bit.

# Compositions

1 + 2

What if we want to add bunch of numbers at once? Well, we could write

1 + 2 + 3

or, in a very unusual way:

+ 1 2 3

This is called prefix notation. As you can see, it is more compact and concise.

This is a visualization of a toy pipeline. There is an operator - the left-most symbol, and a sequence of operands - a list of symbols on the right.

Imagine that all the operands are shifting to the left, one by one, as we do the addition.

First, we take 1 and add it to nothing, to zero. Thus we got 1 as a result. Then we take 2 and add it to 1 - it is 3. Then we take 3 and add it to the result (also 3) - we got 6. Nothing more to add - we are done, and we return the result.

Now look at this.

* 2 + 3 4

There is an ambiguity - our toy pipeline is messed up, because we have a symbol "plus", which is associated with "addition" procedure, in the list of arguments to the operation "multiplication".

We must use parenthesis to group the operations together and clarify everything. Now we have

(* 2 (+ 3 4))

which looks much better.

If the expression

(+ 1 2 3)

is a small pipeline, then the expression

(* 2 (+ 3 4))

is a pipeline inside of another pipeline!

This means we must evaluate the inner expression first, then substitute the result of evaluation for the expression and get

(* 2 7)

This substitution, by the way, is a transformation, like in movies.

Now we can evaluate this expression, and get the result - 14.

Why we call this a pipeline? Because we can say

(* 2 3 (+ 4 5 6) 7 (+ 8 9))

and could extract the meaning in a fraction of a second.

Fist we are evaluating all the sub-expressions, substitute the results in the body, and then evaluate the transformed expression.

The big idea is that we could have a compound expressions in place of any other symbol.

The even bigger idea is that we can substitute the whole expression with the associated symbol, which means to replace one for another right in-place. We can mix symbols and expressions (which, in turn, are lists of symbols, which may be associated with another expressions) as we wish.

Symbols, then, are just labels - names for primitive or compound expressions, the same way words of language are names for some objects in our mind.

**Note:**See TracWiki for help on using the wiki.