1.6  Example: Design recipe for functions

;; Purpose and Contract:
;; compute the distance a vehicle can travel on one tank, 
;; given its size and the mpg consumption
;; Number Number -> Number
;; (define (range t-size mpg)

;; Examples:
;; (range 20 10) "should be" 200
;; (range 15 20) "should be" 300

;; Template:
;; ... t-size... ...mpg...

;; Program:
(define (range t-size mpg)
  (* t-size mpg))

;; Tests:
(= (range 20 10) 200)
(= (range 15 20) 300)

1.7  Example: Design recipe: functions with structure args

;; Purpose and Contract:
;; compute the distance an auto can travel on one tank of fuel 
;; Auto -> Number
;; (define (auto-range a)

;; Examples:
;; (auto-range auto1) "should be" 300
;; (auto-range auto2) "should be" 180

;; Template:
;; ... (auto-model a) ...
;; ... (auto-tank-size a) ... 
;; ... (auto-mpg a) ...

;; Program:
(define (auto-range a)
  (* (auto-tank-size a) (auto-mpg a)))

;; Tests
(= (auto-range auto1) 300)
(= (auto-range auto2) 180)