Intermezzo 3: Local Definitions and Lexical Scope

#drsecintlocal#22653> Programs do not just consist of single definitions. In many cases, a program requires the definition of auxiliary functions or of functions with mutual references. Indeed, as we become more experienced, we write programs that consist of numerous auxiliary functions. If we are not careful, these large collections of functions overwhelm us. As the size of our functions grows, we need to organize them so that we (and other readers) can quickly identify the relationship among parts. This section introduces <#64518#><#22654#>local<#22654#><#64518#>, a simple construct for organizing collections of functions. With <#64519#><#22655#>local<#22655#><#64519#>, a programmer can group function definitions that belong together so that readers immediately recognize the connection among the functions. Finally, the introduction of <#64520#><#22656#>local<#22656#><#64520#> also forces us to discuss the concept of variable binding. While the variable and function definitions of <#22657#>Beginning Student<#22657#> Scheme already introduce bindings into a program, a good <#64521#><#22658#>local<#22658#><#64521#> definitions is only possible with a thorough familiarity of this concept.