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 19.1.5) (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 ;; mini : nelon -> number
5 ;; to determine the smallest number
6 ;; on alon
7 (define (mini alon)
8 (cond
9 [(empty? (rest alon)) (first alon)]
10 [else (cond
11 [(< (first alon)
12 (mini (rest alon)))
13 (first alon)]
14 [else
15 (mini (rest alon))])]))
17 ;; maxi : nelon -> number
18 ;; to determine the largest number
19 ;; on alon
20 (define (maxi alon)
21 (cond
22 [(empty? (rest alon)) (first alon)]
23 [else (cond
24 [(> (first alon)
25 (maxi (rest alon)))
26 (first alon)]
27 [else
28 (maxi (rest alon))])]))