Skip to content

Instantly share code, notes, and snippets.

@kouddy
Created March 22, 2015 02:16
Show Gist options
  • Save kouddy/0f5e5510ea83b05cf8e5 to your computer and use it in GitHub Desktop.
Save kouddy/0f5e5510ea83b05cf8e5 to your computer and use it in GitHub Desktop.
(define (make-rect p1 p2) (make-segment p1 p2))
(define (width r) (- (x-point (end-segment r)) (x-point (start-segment r))))
(define (length r) (- (y-point (end-segment r)) (y-point (start-segment r))))
(define (area r) (* (width r) (length r)))
(define (perimeter r) (* (+ (width r) (length r)) 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment