Introduction to Programming with Mathematica, Third Edition

Expressions are the basic building blocks from which everything is built. Their structure, internal representation, and how they are evaluated are essential to understanding Mathematica. In this chapter we focus on the Mathematica language with particular emphasis on the structure and syntax of expressions. We will also look at how to define and name new expressions, how to combine them using logical operators, and how to control properties of your expressions through the use of attributes.
Although it may appear different at first, everything that you will work with in Mathematica has a similar underlying structure. This means things like a simple computation, a data object, a graphic, the cells in your Mathematica notebook, even your notebook itself, all have a similar structure ? they are all expressions, and an understanding of expressions is essential to mastering Mathematica.
When doing a simple arithmetic operation such as 3 + 4 * 5, you are usually not concerned with exactly how a system such as Mathematica actually performs the additions or multiplications. Yet you will find it extremely useful to be able to see the internal representation of such expressions as this will allow you to manipulate them in a consistent and powerful manner.
Internally, Mathematica groups the objects that it operates on into different types: integers are distinct from real numbers; lists are distinct from numbers. One of the reasons that it is useful to identify...