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

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:

#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.

#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.

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.

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

#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!

Try this:

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

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