나는 녹색, 노란색 또는 빨간색과 어떤 문자열이 두 문자열에 따라 교통 신호등의 사진을 출력왜이 코드는 라켓에 메모리 부족 오류 코드가 부족합니까?
(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)]))
숙제와 관련된 것 같습니다. "How to Design Programs"에 기반한 수업을 듣고 있다면 디자인 레시피의 어떤 단계를 말해 줄 수 있습니까? –
헤더 부분 그냥 모양을 사용하여 신호등을 만들 필요가 있고 문제가 발생했습니다. 수표가 예상대로 작동하므로 혼동을 일으킬 수 있습니다. 이유는 무엇입니까? – user6824158
오? 좋습니다, 그 경우에는 어떤 목적 진술도 보이지 않습니다. 그들을 추가 할 수 있습니까? –