Lab Module F -- Procedures as first class objects

CISC 280 Program Development Techniques

Goals:

  1. Write procedures which manipulate (proper) lists.
  2. Specifically build skill in using cons, car, cdr, null?, and null in procedures which take and/or return lists.

Reading: SICP (Structure and Interpretation of Computer Programs), Section 2.2.1


Homework exercises (Due at start of lab 19 Mar 2001):

  1. SICP Exercises 2.21 and 2.22.(about a square-list procedure).

    Remark: It is very hard to make an iterative version of square-list or map without using assignment. (Assignment is not introduced in this course until chapter 3.) An iterative process would be one which uses a constant amount of memory beyond that for the input and output lists. This remark is a mind-teaser for those who want to think more deeply about the issue. It is not part of the assigned work.

  2. SICP Exercise 2.23 (the for-each procedure)

  3. SICP Exercise 2.26 (cons, list, and append) For each of the three results, write both the print representation given by the interpreter and the box-and-pointer representation of the result.

Module D Flourish (optional problem):

  1. SICP Exercise 2.28 (the fringe procedure)