Blob


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 |23.1|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 ;; make-even : N -> N[even]
5 ;; to compute the i-th even number
6 (define (make-even i)
7 (* 2 i))
9 ;; make-odd : N -> N[odd]
10 ;; to compute the i-th odd number
11 (define (make-odd i)
12 (+ (* 2 i) 1))
14 ;series-local : (N -> N) -> (N -> number)
15 (define (series-local a-term)
16 (local ((define (series n)
17 (cond
18 [(= n 0) (a-term n)]
19 [else (+ (a-term n)
20 (series (- n 1)))])))
21 series))
23 (define series-even (series-local make-even))
24 (series-even 10)