Versions Compared

Key

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

Scope and Abstract

...

Functions

Instructions for students & labbies: Students use DrScheme, following the design recipe, on the exercises at their own pace, while labbies wander among the students, answering questions, bringing the more important ones to the lab's attention.

...

  • Develop the function without using local. For the purposes of this exercise, do not use any helper functions, nor the
    built-in Scheme function max. You will inevitably have to make exactly the same recursive call twice is the same control path.

Stylistically what don't (or shouldn't) you like about this code?

  • Develop the a more efficient version of this function using local. Again, don't use a helper function, or max, but avoid making the same recursive call twice on the same control path.

Try running each version on the following input (or longer ones):

(list 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)

If it is convenient, use your up function from last lab to avoid typing long input lists like the preceding one.

What difference do you see?

For each version, determine approximately how many calls to your function is made for the input

(list 1 2 3 ... n)

for various values of n.

Can you write a mathematical equation that describes this number of calls?
(This exercise is a small example of what you'd learn to do in COMP 280.)

...