Lecture 20 Objectives
At the end of today's class you should
KNOW:
- What a variable is
- How to make Scheme remember a result that changes over time
- Why set! can't be used to change the value of a function argument
- How to test functions that change the values of variables
- How to use error to report an error condition
BE ABLE TO:
- Use set! to redefine a named variable
- Document variables
- Document a function that changes the value of a variable
- Develop a set of test cases to adequately test a function that
uses set!
Sample Exam Question:
Using the data definitions for account and list-of-account
that we defined in class, write a function withdraw-funds that takes
an account number and an amount of money and adjusts the balance in the
given account by subtracting the amount of the withdrawal.
If the original amount of the balance is less than the
amount to be withdrawn, print an error message.