1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-intermediate-reader.ss" "lang")((modname 21.1.1) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp")))))
4 Exercise 21.1.1. Define tabulate, which is the abstraction of the following two functions:
6 ;; tabulate-sin : number -> lon
7 ;; to tabulate sin between n
8 ;; and 0 (inclusive) in a list
9 (define (tabulate-sin n)
11 [(= n 0) (list (sin 0))]
14 (tabulate-sin (sub1 n)))]))
16 ;; tabulate-sqrt : number -> lon
17 ;; to tabulate sqrt between n
18 ;; and 0 (inclusive) in a list
19 (define (tabulate-sqrt n)
21 [(= n 0) (list (sqrt 0))]
24 (tabulate-sqrt (sub1 n)))]))
25 Be sure to define the two functions in terms of tabulate. Also use tabulate to define a tabulation function for sqr and tan. What would be a good, general contract? Solution