|numbers||sequences of binary digits|
|strings||sequences of character code bytes or byte pairs|
|symbols||pointers to the central table of symbols|
|general expressions||sequences of pointers to the head and elements|
In general, different pieces of your expression will be stored at different places in memory. Thus, for example, for a list such as the "backbone" of the list will be stored at one place, while each of the actual elements will be stored at a different place.
The backbone of the list then consists just of three "pointers" that specify the addresses in computer memory at which the actual expressions that form the elements of the list are to be found. These expressions then in turn contain pointers to their subexpressions. The chain of pointers ends when one reaches an object, such as a number or a string, which is stored directly as a pattern of bits in computer memory.
Crucial to the operation of Mathematica is the notion of symbols such as . Whenever appears in an expression, Mathematica represents it by a pointer. But the pointer is always to the same place in computer memory—an entry in a central table of all symbols defined in your Mathematica session.
This table is a repository of all information about each symbol. It contains a pointer to a string giving the symbol's name, as well as pointers to expressions that give rules for evaluating the symbol.
Every piece of memory used by Mathematica maintains a count of how many pointers currently point to it. When this count drops to zero, Mathematica knows that the piece of memory is no longer being referenced, and immediately makes the piece of memory available for something new.
|• Create an expression corresponding to the input you have given.|
|• Process the expression using all rules known for the objects in it.|
|• Generate output corresponding to the resulting expression.|
When the function is one of the thousand or so that are built into Mathematica, what the evaluator does is to execute directly internal code in the Mathematica system. This code is set up to perform the operations corresponding to the function, and then to build a new expression representing the result.
A crucial feature of the built-in functions in Mathematica is that they support universal computation. What this means is that out of these functions you can construct programs that perform absolutely any kinds of operations that are possible for a computer.
As it turns out, small subsets of Mathematica's built-in functions would be quite sufficient to support universal computation. But having the whole collection of functions makes it in practice easier to construct the programs one needs.
The underlying point, however, is that because Mathematica supports universal computation you never have to modify its built-in functions: all you have to do to perform a particular task is to combine these functions in an appropriate way.
Universal computation is the basis for all standard computer languages. But many of these languages rely on the idea of compilation. If you use C or Fortran, for example, you first write your program, then you compile it to generate machine code that can actually be executed on your computer.
Often Mathematica will preprocess expressions that you enter, arranging things so that subsequent execution will be as efficient as possible. But such preprocessing never affects the results that are generated, and can rarely be seen explicitly.