Lab Review Guideline for Labs 4, 6, 7 & 8
This page is intended merely as a guide
and should in no way be construed as exhaustive.
Advice:
Be sure to give examples when creating data definitions! This was the cause
of many problems in the S-expressions homework (HW
5)!
Family Trees
- Defining non-linear data structures
- Creating templates based on non-linear data structures
- Navigating through trees
Natural Numbers
- Numbers as lists
- Recurring over a number
Mutual Recursion
- Data structures consisting of multiple, linked data structures
- Program structure to process a mutually recursive data structure (use of
helpers).
Accumulators
- How to write an accumulator style function using helpers
- Using accumulators to retain information about the outer layers of the recursion
process to be used in the inner layers of the recursion, e.g. find last element
algorithm.
Locals
- To eliminate multiple identical calculations
- To define symbol equivalents of values to simplify later code
- To hide helper functions
Abstract ("higher order") functions
- Functions that take functions as arguments
- Lambda (anonymous) functions
- Curried functions -- functions that produce functions whose behavior depends
on how they were made.
- To abstract whole processes that involve other functions, e.g. map, filter,
foldr, foldl