I'm learning scheme and having a hard time with the define-syntax part. The tutorials online that I have found are not very helpful, so any help you guys can offer would be greatly appreciated. Basically I need to be able to enter (foreach x : 1 do (display x)) and have it output 1, or enter (foreach x : 1 2 3 4 5 6 do (display x)). I have a start but I'm not sure if I am even on the right track or not. What I have is:
(define-syntax foreach
(syntax-rules ()
[(foreach x : y) (display y)]
[(foreach x : y ...) (display y)]
)
)
(define (display x) x)