Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

b) Use Scheme's built-in functions.    First, you must explicitly define that you are going to use a list of exactly two elements, i.e. "(list a b)".    Scheme already provides functions to access the first and second elements of such a list, oddly enough, called "first" and "second":

...

  • Write down and follow the list function template!
  • Think about what can be done with what your template says you have to work with, namely, Code Block(first aList) and the recursive result, Code Block (myFunction (rest aList)).
  • Never think in terms of more than one element of the list at a time (this is equivalent to the previous statement). This means do NOT think in terms of finding the length of the list or finding the middle of the list or anything of that nature! Think "first" and "rest", period.
  • Use a Code Blocklocal definition to keep you from repeating the recursive call.