# Code doesn't work, not surprised however it's yet another example from a book

**URL:** <https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568>\
**Category:** Questions & Answers\
**Created:** [February 16, 2025, 5:00am UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568 "2025-02-16T05:00:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![munroec](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@munroec](https://racket.discourse.group/u/munroec)\
**Post date:** [February 16, 2025, 5:00am UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/1 "2025-02-16T05:00:02Z")

</div>

Things were was executing ok until I added section that I have marked which was supposed to plot the the set union. I was very suspicious of the code that as the offending terms were never defined. Any thoughts on what it should be? And a general question, what is the significance when some identifiers are all in capitol letters, other than the obvious of differentiating it from, a keyword of same name. Is there something more too that?  
I know it's a lo of questions however, I've searched through the online docs a my small library of books on Racket. Too either the answers are in there or I've finally slipped over the edge and ready to. be moved to Shady Pines Elder Estate! 🤣

Cheers,  
Munroe

The Code:

```scheme
#lang racket ;set theory 2 PTFW pp 97 thru top of pp 100
(require racket/draw)
(define WIDTH 150)
(define HEIGHT 100)

(define venn (make-bitmap WIDTH HEIGHT))
(define dc (new bitmap-dc% [bitmap venn]))

(send dc scale 1.0 -1.0)
(send dc translate (/ WIDTH 2) (/ HEIGHT -2))
(send dc set-smoothing 'smoothed)
(send dc set-pen "black" 2 'solid)

(define IN-BRUSH (new brush% [color "green"]))
(define OUT-BRUSH (new brush% [color (make-object color% 220 220 220)]))

(define (rect x y w h b)
  (let ([x (- x (/ w 2))]
        [y (- y (/ h 2))])
    (send dc set-brush b)
    (send dc draw-rectangle x y w h)))

(define (circle x y r b)
  (let ([x (- x r)]
        [y (- y r)])

    (send dc set-brush b)
    (send dc draw-ellipse x y (* 2 r) (* 2 r))))

(define (universe b) (rect 0 0 (- WIDTH 10) (- HEIGHT 10) b))

(universe OUT-BRUSH)
(circle 0 0 30 IN-BRUSH)
venn

(send dc erase)
(universe IN-BRUSH)
(circle 0 0 30 OUT-BRUSH)
venn

(define (piscis x y r b)
  (let* ([y (- y r)]
         [2r (* 2 r)]
         [y1 (sqrt (- (sqr r) (sqr x)))] ;y-intercept
         [π pi]
         [ø (asin (/ y1 r))]
         [𝜭 (- π ø)]
         [path (new dc-path%)])
    (send dc set-brush b)
    (send path move-to 0 (- y1))
    (send path arc (- x r) y 2r 2r 𝜭 (+ π ø))
    (send path arc (- (- x) r) y 2r 2r (- ø) ø)
    (send dc draw-path path)))

(define SET-BRUSH (new brush% [color (make-object color% 220 255 250)]))

(define(venn-bin b1 b2 b3)
  (universe OUT-BRUSH)

;Racket obviously complains that "CIRCLE-OFF is an unbound entity. I ;considering typos such as the offending term should be lower case. But more ;troubling I have no clue what that general form is trying to accomplish? 
***** (circle (- CIRCLE-OFF) 0 30 b1)
***** (circle CIRCLE-OFF 0 30 b3)
***** (piscis CIRCLE-OFF 0 30 b2)
  (print venn))

(venn-bin IN-BRUSH IN-BRUSH IN-BRUSH)

```

---

<div class="post-metadata">

**Author:** ![rogert](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/rogert/32/2474_2.png) [@rogert](https://racket.discourse.group/u/rogert)\
**Post date:** [February 16, 2025, 7:07am UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/2 "2025-02-16T07:07:59Z")

</div>

Add `(define CIRCLE-OFF 20)` to the code.

(Uppercase identifiers are conventionally used as names for constants)

---

<div class="post-metadata">

**Author:** ![damien\_mattei](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/damien_mattei/32/2706_2.png) [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Post date:** [February 16, 2025, 10:20am UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/3 "2025-02-16T10:20:48Z")

</div>

For those wanting to learn Scheme/Racket from scratch here is a cool course:

> **[Intro Scheme en L1 Info et Math](http://jean.paul.roy.free.fr/PCPS/PF1/scheme1.html)**
>
> Scheme Racket

unfortunately in "Français" only 😅

---

<div class="post-metadata">

**Author:** ![munroec](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@munroec](https://racket.discourse.group/u/munroec)\
**Post date:** [February 16, 2025, 1:58pm UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/4 "2025-02-16T13:58:29Z")

</div>

Hi Rodger,

Thank you for the very prompt reply to my newbie question.

Well that certainly fixed the problem however, why? I understand defining CIRCLE-OFF but why "20” ?? As an aside, I’m constantly frustrated by the errors and/or omissions in all of the texts on Racket currently in my library. I would dearly love to purchase a tutorial text that wasn’t plagued with issues like, this and whilst I’m whining , most of them lack an index so the inclusion of that would be a huge plus.

Cheers,

M.C. “Moe” Clayton

“Old age ain't no place for sissies.”

― Bette Davis

Sent from

---

<div class="post-metadata">

**Author:** ![munroec](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@munroec](https://racket.discourse.group/u/munroec)\
**Post date:** [February 16, 2025, 2:02pm UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/5 "2025-02-16T14:02:35Z")

</div>

| 

 ![](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/1/1a82cfeded1c57c136746d0b67f58df2c1073f50.png)

 |

| 

**Canary Mail**  
**You've received a secure email**

 |

| 

Munroe Clayton has sent you a secure email via Canary Mail.

 |

| |

| 

[Read Secure Email](https://secure.canarymail.io/read?obj_id=529a6f46-9004-46a0-bd4a-3b29a2767a1d&obj_key=VmRjS2NHNnUvZHdzdnROMTZUb1dGZz09&thr_id=529a6f46-9004-46a0-bd4a-3b29a2767a1d)

 |

| |

| |

| |

| 

If you expect to correspond often with Munroe Clayton, we recommend you download Canary Mail for free.

 |

| |

| 

[Download Canary](https://canarymail.io)

 |

| |

| |

| 

[![Twitter](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/9/941c03d81c059187d19adef2a603701af26cc4ef.png)](http://www.twitter.com/CanaryMailApp)

 |

| 

[![Website](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/7/7115e2027e728d9f71f21ac4d6a2cf04a6f39638.png)](https://canarymail.io)

 |

| 

[Privacy](https://canarymail.io/privacy.html) | [Terms](https://canarymail.io/terms.html) | [Docs](https://help.canarymail.io/) | [Support](https://canarymail.zendesk.com/hc/en-us/requests/new)

Copyright © 2021 Canary Mail, All rights reserved.

 |

| |

---

<div class="post-metadata">

**Author:** ![munroec](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@munroec](https://racket.discourse.group/u/munroec)\
**Post date:** [February 16, 2025, 3:08pm UTC](https://racket.discourse.group/t/code-doesnt-work-not-surprised-however-its-yet-another-example-from-a-book/3568/6 "2025-02-16T15:08:17Z")

</div>

| 

 ![](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/1/1a82cfeded1c57c136746d0b67f58df2c1073f50.png)

 |

| 

**Canary Mail**  
**You've received a secure email**

 |

| 

Munroe Clayton has sent you a secure email via Canary Mail.

 |

| |

| 

[Read Secure Email](https://secure.canarymail.io/read?obj_id=a1497c14-34c9-4484-be73-dc6b15dd824d&obj_key=K1d1cXJNbExpYWZzMG1XdnZOTDlWdz09&thr_id=a1497c14-34c9-4484-be73-dc6b15dd824d)

 |

| |

| |

| |

| 

If you expect to correspond often with Munroe Clayton, we recommend you download Canary Mail for free.

 |

| |

| 

[Download Canary](https://canarymail.io)

 |

| |

| |

| 

[![Twitter](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/9/941c03d81c059187d19adef2a603701af26cc4ef.png)](http://www.twitter.com/CanaryMailApp)

 |

| 

[![Website](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/7/7115e2027e728d9f71f21ac4d6a2cf04a6f39638.png)](https://canarymail.io)

 |

| 

[Privacy](https://canarymail.io/privacy.html) | [Terms](https://canarymail.io/terms.html) | [Docs](https://help.canarymail.io/) | [Support](https://canarymail.zendesk.com/hc/en-us/requests/new)

Copyright © 2021 Canary Mail, All rights reserved.

 |

| |
