Honors 295 - Fall 2003
Writing 2: Map

Due at the start of class, Sept 24


Description

Write a two-page, double-spaced explanation of how map works.

 (define map
    (lambda (f l)
       (cond
         ((null? l) '())
         (else (cons (f (car l))
                     (map f (cdr l)))))))

Imagine explaining map to yourself three weeks ago (or whenever you were first learning Scheme). You might include a qualitative description of its input and its output. You might describe why the code looks this way, with the null? and the else and the car and the cdr. You might trace through how map gets executed, in general and in a particular case. You might talk about how map can be used, and give examples of map in action. Pick a good subset, within the space you have, to describe map thoroughly. But be careful; you can cram your explanation with so many aspects that you don't have room to cover each one well.

Concentrate on finding your own words. See if you can learn something by making up your own new way of describing map or lists or procedures or recursion. But be clear and precise. Your description should be true.

Finally, assume that you have an audience that wants to know how map works, but doesn't yet. Don't write a fancy introduction or conclusion about the joys of Scheme. You can leave out the sentence that says: "The formidable function map epitomizes the awesome utility of Scheme programming." Also, don't write your description of map as a letter to the professors in a class showing that you understand. You can also leave out the sentence that says: "My answer to this assignment is that map operates on lists."

295 Home