Functional Problem Solving (CSC 151 2013F) : Outlines

Outline 20: Naming Local Values


Held: Wednesday, 2 October 2013

Back to Outline 19 - Iteration. On to Outline 21 - Boolean Values and Predicate Procedures.

Summary

We consider why and how you name values within a procedure. We also consider why and how you limit access to those names to within the procedure.

Related Pages

Overview

Administrivia

The Problem: Naming Values

Naming Things with let

* If we want to bind some things in sequence, we need to use let rather than let. * let has the form (let* ((name1 exp1) (name2 exp2) ... (namen expn)) body) * let has the meaning: * Evaluate *exp1. * Update the binding table to associate name1 with that value. * Evaluate exp2. * Update the binding table to associate name2 with that value. * ... * Evaluate expn. * Update the binding table to associate namen with that value. * Evaluate body using the updated binding table. * Eliminate all the bindings just created.


Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2013 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.