-
Notifications
You must be signed in to change notification settings - Fork 13
The Expander
Siddhartha Kasivajhula edited this page Mar 19, 2024
·
2 revisions
The Qi expander is implemented with Syntax Spec. See Source Code Overview to find the implementation in the codebase.
The expander expands Qi surface syntax (including macros) to the Qi core language. This core language is then compiled to Racket.
To see what a Qi expression expands to, you could use the expand-flow
compile-time function to expand expressions on demand. This function expects to be called during macroexpansion, so you can use the phase1-eval
utility from the syntax/macro-testing
collection to do that. For example:
(require qi
(submod qi/flow/extended/expander invoke)
syntax/macro-testing)
(phase1-eval
(expand-flow #'(~>> (filter odd?) (map sqr))))
which produces:
'(thread
(#%blanket-template ((#%host-expression filter) (#%host-expression odd?) __))
(#%blanket-template ((#%host-expression map) (#%host-expression sqr) __)))
Home | Developer's Guide | Calendar | Events | Projects | Meeting Notes