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 18.2.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 (define (p1 a y)
5 (+ (* a y)
6 (+ (* 2 a)
7 (+ (* 2 y) 22))))
9 (define (p2 x)
10 (+ (* 55 x) (+ x 11)))
12 (define (p3 b)
13 (+ (p1 b 0)
14 (+ (p1 b 1) (p2 b))))
16 (define (f x)
17 (local ((define (g x) (+ 2 (* x 2))))
18 (g x)))
20 (define (a-function y)
21 (local ((define (f x y) (+ (* x y) (+ x y)))
22 (define (g z)
23 (local ((define (f x) (+ (* x x) 55))
24 (define (g y) (+ (f y) 10)))
25 (f z)))
26 (define (h x) (f x (g x))))
27 (h y)))
29 ;; sort : list-of-numbers -> list-of-numbers
30 (define (1sort alon)
31 (local ((define (sort alon)
32 (cond
33 [(empty? alon) empty]
34 [(cons? alon) (insert (first alon) (sort (rest alon)))]))
35 (define (insert an alon)
36 (cond
37 [(empty? alon) (list an)]
38 [else (cond
39 [(> an (first alon)) (cons an alon)]
40 [else (cons (first alon) (insert an (rest alon)))])])))
41 (sort alon)))
43 (define x (cons 1 x))