;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname functions) (read-case-sensitive #t) (teachpacks ((lib "universe.ss" "teachpack" "2htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "universe.ss" "teachpack" "2htdp"))))) (define PI 3.14) ;; square number -> number ;; square a number x (define (square x) (* x x)) (check-expect (square 2) 4) (check-expect (square 1) 1) ;; area-of-disk number -> number ;; calculate area of disk with radius r (define (area-of-disk r) (* PI (square r))) (check-expect (area-of-disk 10) 314) ;; area-of-ring : number number -> number ;; compute the area of a ring with radius ;; outer and hole radius of inner (define (area-of-ring outer inner) (- (area-of-disk outer) (area-of-disk inner))) (check-expect (area-of-ring 5 3) 50.24)