Expressions
Primitive expressions represent the simplest entities that a programming language is concerned with. You type an expression, and the interpreter responds by displaying the result of its evaluating that expression.
We delimit expressions within parentheses in order to denote procedure application; these expressions are called combinations.
- Leftmost element (+): Operator
- Other elements (137, 349): Operands
The convention of placing the operator to the left of the operands is known as prefix notation; the main benefit of this is that we can use multiple arguments like:
We can also make nested expressions:
Naming & Environment
Define variables using define
:
Define
is our language’s simplest means of abstraction, for it allows us to use simple names to refer to the results of compound operations. This feature encourages the incremental development and testing of programs.
Since we can associate values with symbols and retrieve them later, the interpreter must be able to maintain some sort of memory that keeps track of the name-object pairs. This memory is called the environment (more precisely the global environment, since we will see later that a computation may involve a number of different environments).