我需要创建一个定义,根据绿色黄色或红色的字符串输出交通灯的图片,无论字符串是什么都决定了哪个灯泡是实心的
(define green-light
(overlay (above (circle 15 "solid" "green")
(circle 15 "outline" "yellow")
(circle 15 "outline" "red"))
(rectangle 50 100 "outline" "black")))
(define yellow-light
(overlay (above (circle 15 "outline" "green")
(circle 15 "solid" "yellow")
(circle 15 "outline" "red"))
(rectangle 50 100 "outline" "black")))
(define red-light
(overlay (above (circle 15 "outline" "green")
(circle 15 "outline" "yellow")
(circle 15 "solid" "red"))
( rectangle 50 100 "outline" "black")))
(check-expect (TrafficLightState "green")
(overlay (above (circle 15 "solid" "green")
(circle 15 "outline" "yellow")
(circle 15 "outline" "red"))
(rectangle 50 100 "outline" "black")))
(check-expect (TrafficLightState "yellow")
(overlay (above (circle 15 "outline" "green")
(circle 15 "solid" "yellow")
(circle 15 "outline" "red"))
(rectangle 50 100 "outline" "black")))
(check-expect (TrafficLightState "red")
(overlay (above (circle 15 "outline" "green")
(circle 15 "outline" "yellow")
(circle 15 "solid" "red"))
(rectangle 50 100 "outline" "black")))
(define (TrafficLightState color)
(cond [(TrafficLightState "green") (place-image green-light)]
[(TrafficLightState "yellow") (place-image yellow-light)]
[(TrafficLightState "red") (place-image red-light)]))