Back Edit Delete

TrafficLight is one of the strings "red", "yellow", or "green". Write the data definition and template. In the template, use placeholders for unfinished function behavior rather than accidentally calling the parameter as a function.

Short answer

Accepted answer

; TrafficLight is one of:
; - "red"
; - "yellow"
; - "green"
; interp. the current state of a traffic light
#;
(define (fn-for-traffic-light tl)
(cond [(string=? tl "red") (...)]
[(string=? tl "yellow") (...)]
[(string=? tl "green") (...)]))