Created
November 2, 2019 23:11
-
-
Save chelseatroy/0ae0bdd6f8e65beaef69ea6d402ea64f to your computer and use it in GitHub Desktop.
Alice Box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define (make-alice-box x1 y1 x2 y2) | |
(cons (cons x1 y1) (cons x2 y2))) | |
(define (alice-width box) | |
(abs (- (car (cdr (box)) | |
(car (car (box))))) | |
(define (alice-height box) | |
(abs (- (cdr (cdr (box)) | |
(cdr (car (box))))) | |
(define (alice-area box) | |
(* (alice-width box) | |
(alice-height box))) | |
(define a (make-alice-box 1 2 3 4)) | |
(alice-area a) ;--> 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment