Example: two Posn arguments
;; Contract and Purpose
;; Posn Posn -> Number
;; compute the distance between p1 and p2
;; (define (dist p1 p2) ...
;; Examples:
;; (= (dist p1 p2) 20)
;; (= (dist p2 p3) 30)
;; (= (dist p3 (make-posn 50 50)) 20)
;; Template:
;; ... (posn-x p1) ... (posn-x p2)...
;; ... (posn-x p2) ... (posn-y p2) ...
;; Program:
(define (dist p1 p2)
(+ (abs (- (posn-x p1) (posn-x p2)))
(abs (- (posn-y p1) (posn-y p2)))))
;; Tests:
(= (dist p1 p2) 20)
(= (dist p2 p3) 30)
(= (dist p3 (make-posn 50 50)) 20)