Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  1. Make a data definition for non-empty lists of numbers. Hint: The base case should not be empty, since that is not a non-empty list of numbers! What is a description of the shortest non-empty list of numbers?
  2. Develop a program which takes a non-empty list of numbers and returns the average (a.k.a, arithmetic mean) of all the numbers.
  3. Develop a program which takes a standard, potentially empty list of numbers and returns the average of all the numbers. For this example, arbitrarily define the average of an empty list to be false.

Here are two reasonable definitions for non-empty lists.