# Class 17: Recursion with Natural Numbers

Back to More Recursion with Lists. On to Pairs.

Held Friday, September 27, 2002

Summary

Today we consider recursion over a different domain, the natural numbers.

Assignments

Notes

• I'd recommend that you read the notes on homework 2.
• With your permission, I'm going to reuse parts of your answers in a sample writeup for next year's class.
• We may have prospies today.
• Microsoft has just released a vision of the future. I particularly like the idea of voice mail over email. As one colleague suggested, Several contributors to the Slashdot commentary on this story are looking forward to the arrival of spam in the Cubicle of the Future, complete with Active X controls that crank up the volume before rendering those invitations to [spam topic of your choice].

Overview

• Introduction to numeric recursion
• Lab

## Recursion with Numbers

• While most of the recursion we've been doing has used lists as the structure to recurse over, you can recurse with many different kinds of values.
• It is fairly common to recurse using numbers.
• The natural base cases for integers are when you hit 0 or when you hit 1.
• The natural parameter for recursive procedure calls typically involves subtracting 1 from the argument.

## Lab

• Do the lab.
• Since it's comparatively short, we may have a few minutes to reflect at the end.

## History

Thursday, 29 August 2002

Back to More Recursion with Lists. On to Pairs.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 2 08:41:09 2002.
The source to the document was last modified on Tue Sep 3 23:13:30 2002.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Outlines/outline.17.html`.

You may wish to validate this document's HTML ; ; Check with Bobby

Samuel A. Rebelsky, rebelsky@grinnell.edu