Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created November 2, 2019 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/0ae0bdd6f8e65beaef69ea6d402ea64f to your computer and use it in GitHub Desktop.
Save chelseatroy/0ae0bdd6f8e65beaef69ea6d402ea64f to your computer and use it in GitHub Desktop.
Alice Box
#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