Last active
August 20, 2019 14:16
-
-
Save belmarca/dfb59f9a28e6d76e57c371c2f5e9b2b9 to your computer and use it in GitHub Desktop.
Gerbil scheme reverse syntax macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defsyntax (reverse-me stx) | |
(syntax-case stx () | |
((macro . args) | |
(with-syntax () | |
(datum->syntax #'macro (reverse (syntax->datum #'args))))))) | |
;; > (reverse-me "backwards" "am" "I" values) | |
;; "I" | |
;; "am" | |
;; "backwards" |
this is slightly wrong, the correct from is
(defsyntax (reverse-me stx)
(reverse (cdr (syntax->list stx))))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is shorter: