global-vs-local-syntax-definition.scm 511 B

123456789101112131415161718
  1. ;; FROM: https://www.gnu.org/software/guile/manual/html_node/Defining-Macros.html#Defining-Macros
  2. ;; global syntax definition
  3. (define-syntax when
  4. (syntax-rules ()
  5. ((when condition exp ...)
  6. (if condition
  7. (begin exp ...)))))
  8. ;; local syntax definition
  9. (let-syntax ([unless (syntax-rules ()
  10. ((unless condition exp ...)
  11. (if (not condition)
  12. (begin exp ...))))])
  13. (unless #t
  14. (primitive-exit 1))
  15. "rock rock rock")