Comp210: Principles of Computing and Programming
Fall 2004 -- Lab #3: List template   


The template development steps are

  1. Use a cond expression with the same number of clauses as the data definition has cases. Use the appropriate predicates in tests for each case. (If the data definition has only one case, skip the cond.)
  2. In each case, show the possible uses of selectors.
  3. In each case, show the possible uses of natural recursion.

For example, the template for a function on list-of-symbols is

     ; los-fun: List-of-Symbol --> ??
     ; A fun(ction) template.

     (define (los-fun a-los)
        (cond
           [(empty? a-los) ...]
           [(cons? a-los)  ...(first a-los)...(los-fun (rest a-los))...]))


Last Revised Tuesday, 24-Aug-2004 13:49:02 CDT

©2004 Stephen Wong and Dung Nguyen