1.) It is often useful to be able to count the number of times a given procedure has been called during the course of a computation. Write a procedure (count-calls f) that takes a procedure of one argument and returns a third procedure. This new function, when applied to the symbol 'how-many-calls?, returns the number of times the wrapped function f has been called. When applied to the symbol 'reset-count!, sets the internal counter to zero. Applied to any other argument, the returned function returns the result of calling f with that argument and updates the internal counter. For example, > (define s (count-calls sqrt) > (s 'how-many-calls?) 0 > (s 100) 10 > (s 'how-many-calls?) 1 2.) Besides measuring run-time using the "time" function in Scheme, the number of times some function gets called can be a useful measure of the cost of an algorithm (this measure reflects less on the programmer and more on the algorithm). Use your result in 1.) to measure the number of comparisons that are used in the various sorting algorithms we have used in class (qsort, sort, another-sort) plus the built-in quicksort. 3.) In numerical integration, we often consider _adaptive_ procedures which keep using more subintervals until convergence happens. We saw such a global iteration in class. You need to implement a locally adaptive process that uses the following criteria. First, integrate the function over the whole interval using one interval and repeat the process with two intervals. We refine an interval if the difference between these two integrations is greater than some criteria. However, if we do two intervals and check the error on each of those intervals, we may find, say, that the left interval has most of the error. We only want to refine that side. Implement such an adaptive procedure, and measure the number of times you call the integrated function f compared with using a small number of intervals everywhere. (Note: the error threshhold on an interval should decrease with respect to it's size. If tolerance is the overall tolerance, we should allow h * tolerance error on an interval of size h.)