Patterns for Repetition
Version 0.0001
Alyce Faulstich Brady
Kalamazoo College, Kalamazoo, MI
abrady@kzoo.edu
This document will be a collection of
elementary patterns by various authors to use in writing code that
requires repeating actions.
The Repetition patterns are:
	
For/Repeat: Repetition with Well-defined Step
General pattern for repetition with a well-defined step to the next
iteration
EXCEPTION: Well-defined step that is equivalent to the initialization
(implemented as a while-loop)
Special Cases:
    
While/Do-while: General Repetition (good name?)
General pattern for repetition
Special Cases:
    
    - Loop
	and a Half, Polling Loop (Astrachan & Wallingford)
    
- Infinite Loop, Infinite Loop Until Exception/Event
    
- Step In Body (e.g., binary search) -- i.e.,
	Step depends on calculations in body, or step is
	purpose of body
    
- Step In Condition (e.g., while ((c = getchar()) != EOF)
    
- Step Equals Init (Don't Repeat Code implies while-loop rather
	than for-loop)
    
- Execution At Least Once
    
- etc.
    
Recursive Repetition:
    
Overall Loop Patterns:
    
Copyright Alyce Faulstich Brady, 1999.