evaluation-time.scm 828 B

12345678910111213141516171819202122
  1. ;; Using eval-when, one can tell Guile when an expression
  2. ;; should be evaluated. eval-when is followed by a list of
  3. ;; phase names. There are 4 phases one can specify: expand,
  4. ;; load, eval, compile. For more information see the
  5. ;; official manual at
  6. ;; https://www.gnu.org/software/guile/manual/html_node/Eval-When.html
  7. ;; Reminder:
  8. ;; #' = syntax -- what you write is just syntax -- pattern variables still inserted
  9. ;; #` = quasisyntax -- for when you need Scheme to calculate parts of the template
  10. ;; #, = unsyntax -- counterpart to quasisyntax -- evaluate expr inside an #` expr
  11. ;; #,@ = unsyntax-splicing -- evaluate and splice
  12. (eval-when (expand load eval)
  13. (define-syntax give-thing
  14. (λ (something)
  15. (syntax-case something ()
  16. [(_ anything)
  17. (syntax
  18. (lambda (a . b) anything))]))))