CSE 341 -- Programming LanguagesWinter 2000 |
Department of Computer Science and Engineering, University of WashingtonSteve Tanimoto (instructor) and Jeremy Baer (teaching assistant). |
Assignment L1Version 1.0 of January 2 |
Lisp WarmupDue date and time: Monday, January 10, 2000, at 10:30 (at the beginning of class).Turn in this assignment as a hardcopy printout. |
Instructions: Read pages 2-58
in Symbols, Programs, Interaction. Do the following exercises:
pp.11-12 (# 1, 2, 3, 4, and 5);
p.16 (# 1, 3, 5, and 7);
p.30 (# 3);
p.136 (# 4)
Finally, write a recursive function Y2K-QUICK-FIX that takes a list as its argument and changes all occurrences of 1999 to 2000, of TWENTIETH-CENTURY to TWENTY-FIRST-CENTURY and SECOND-MILLENNIUM to THIRD-MILLENNIUM. The replacements should be performed not only on top-level elements of the list but also on elements in sublists, sub-sublists, etc.
Here's an example of what this function should do:
(y2k-quick-fix
'(we are talking
twentieth-century technology (it is 1999)
and
this is a second-millennium story) )
; should produce:
(WE ARE TALKING
TWENTY-FIRST-CENTURY TECHNOLOGY (IT IS 2000)
AND THIS IS A
THIRD-MILLENNIUM STORY)
Individual Work: This assignment
requires individual work. Do NOT work in teams on this assignment..
Programming style: In your
solution to the last part of the assignment , comment your function definition
clearly with approximately one comment per line of code. In general you
should learn to use a neat and consistent format for your code, indenting
subexpressions appropriately and choosing symbol names that are appropriate
to the roles they perform in your programs.