6.1 Terminology
6.2 Defining and Executing Procedures
6.3 Parameter Declarations
Required Positional Parameters
Optional Ordered Parameters
Expected Ordered Parameters
Keyword Parameters
The End-of-Parameters Marker
Default Value Dependencies
Parameter Modifiers
The seq Modifier
The depends Modifier
The uneval Modifier
The evaln Modifier
The coercion Modifiers
Procedures without Declared Parameters
6.4 Return Type
6.5 The Procedure Body
Description
Options
The arrow and operator Options
The builtin Option
The call_external Option
The hfloat Option
The inline Option
The overload Option
The procname Option
The remember, cache, and system Options
The trace Option
Variables in Procedures
Global Variables
Local Variables
Lexically Scoped Variables
Scoping Rules
Non-Variable Name Bindings
The Statement Sequence
Referring to Parameters within the Procedure Body
Parameters Are Not Variables
Required Parameters
Parameters with the seq Modifier
Parameters with the uneval or evaln Modifiers
Optional and Expected Ordered Parameters
Keyword Parameters
Special Sequences for Referring to Parameters and Arguments
6.6 How Procedures Are Executed
Binding of Arguments to Parameters
Binding of Keyword Arguments
The Special Case of evaln and uneval Modifiers
Binding of Arguments to Positional and Ordered Parameters
Statement Sequence Interpretation
Variable Evaluation Rules within Procedures
Returning Values from a Procedure
Returning Unevaluated
6.7 Using Data Structures with Procedures
Passing Data Structures to Procedures
Returning Data Structures from Procedures
Example: Computing an Average
Example: Binary Search
Example: Plotting the Roots of a Polynomial
6.8 Writing Usable and Maintainable Procedures
Formatting Procedures for Readability
Commenting Your Code
6.9 Other Methods for Creating Procedures
Functional Operators: Mapping Notation
The unapply Function
Anonymous Procedures
6.10 Recursion
6.11 Procedures that Return Procedures
Example: Creating a Newton Iteration
Example: A Shift Operator
6.12 The Procedure Object
The procedure Type
Procedure Operands
6.13 Exercises