# How can I know the implicit name of a "World", defined in big-bang of 2htdp/universe?

**URL:** https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627
**Category:** Questions & Answers
**Created:** [January 26, 2022, 8:33am UTC](https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627 "2022-01-26T08:33:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cametan](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/cametan/32/190_2.png) [@cametan](https://racket.discourse.group/u/cametan)
#### Post date: [January 26, 2022, 8:33am UTC](https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627/1 "2022-01-26T08:33:24Z")

</div>

Hello.

I want to switch two images, according to the flag defined in a WorldState of big-bang in 2htdp/universe.

Let's say, the experimental code I wrote was like this:

```scheme
#lang racket

(require 2htdp/image 2htdp/universe)

(struct world (flag))

(define (place0 w)
  (place-image
   (text "foo" 15 "black")
   300
   200
   (empty-scene 640 400)))

(define (place1 w)
  (place-image
   (text "bar" 15 "black")
   300
   200
   (empty-scene 640 400)))

(big-bang (world #f)
  (to-draw (if (world-flag world) place0 place1))) ; this does not work

```

I want to change the image shown, according to the flag of the WorldState; however, because the name of the world struct constructed in big-bang is implicitly determined, I do not know how to refer to the "name" of it.

Of course, we can name the WorldState outside of big-bang, as shown below.

```scheme
#lang racket

(require 2htdp/image 2htdp/universe)

(struct world (flag))
(define world_0 (world #f)) ; name the world struct outside of "big-bang"

(define (place0 w)
  (place-image
   (text "foo" 15 "black")
   300
   200
   (empty-scene 640 400)))

(define (place1 w)
  (place-image
   (text "bar" 15 "black")
   300
   200
   (empty-scene 640 400)))

(big-bang world_0
  (to-draw (if (world-flag world_0) place0 place1))) ;; It works!

```

However, I prefer a smarter way, or the way directly to refer to the implicit name, defined by big-bang.

Thanks.

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [January 26, 2022, 12:20pm UTC](https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627/2 "2022-01-26T12:20:41Z")

</div>

![Screen Shot 2022-01-26 at 7.18.58 AM.png](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/4c2754d65230162f360b83088a93dbaa8e0e4392.png)

Neither program “works”. The `to-draw` clause in `big-bang` expects a function, which, in turn, consumes the current state of the world and produces an image.

---

<div class="post-metadata">

### Author: ![cametan](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/cametan/32/190_2.png) [@cametan](https://racket.discourse.group/u/cametan)
#### Post date: [January 26, 2022, 1:31pm UTC](https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627/3 "2022-01-26T13:31:43Z")

</div>

Hmm... It seems better to make a wrapper function than to know the implicit name.

```scheme
#lang racket

(require 2htdp/image 2htdp/universe)

(struct world (flag))

(define (place0 w)
  (place-image
   (text "foo" 15 "black")
   300
   200
   (empty-scene 640 400)))

(define (place1 w)
  (place-image
   (text "bar" 15 "black")
   300
   200
   (empty-scene 640 400)))

(define (place w)
  (if (world-flag w)
     (place0 w)
     (place1 w)))

(big-bang (world #f)
  (to-draw place)) ;; It works!

```

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [January 26, 2022, 2:07pm UTC](https://racket.discourse.group/t/how-can-i-know-the-implicit-name-of-a-world-defined-in-big-bang-of-2htdp-universe/627/4 "2022-01-26T14:07:22Z")

</div>

Try this:

```scheme
(define (place w)
  (if w
     (place0 w)
     (place1 w)))

(big-bang #false
  (on-tick not)
  (to-draw place))

```
