Skip to content

Instantly share code, notes, and snippets.

@shirok
Created July 30, 2011 01:39
Show Gist options
  • Save shirok/1115091 to your computer and use it in GitHub Desktop.
Save shirok/1115091 to your computer and use it in GitHub Desktop.
gosh> (define-syntax for
(syntax-rules (in do)
((for var in lis do expr ...)
(let loop ((xs lis))
(if (not (null? xs))
(begin (let ((var (car xs))) expr ...)
(loop (cdr xs))))))))
#<undef>
gosh> (for x in '(1 2 3 4 5) do (print (* x x)))
1
4
9
16
25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment