Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.