Last active
November 2, 2019 23:11
-
-
Save chelseatroy/bb297b69b8c053709d647df65a8f2b5f to your computer and use it in GitHub Desktop.
Bob Box
This file contains hidden or 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-bob-box x y w h) | |
'bob-box (cons (cons x y) (cons w h))) | |
(define (bob-width box) | |
(car (cdr (box)))) | |
(define (bob-height box) | |
(cdr (cdr (box)))) | |
(define b (make-bob-box 1 2 3 4)) | |
(define (bob-area box) | |
(* (bob-width box) (bob-height box))) | |
(define b (make-bob-box 1 2 3 4)) | |
(bob-area b) ;--> 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment