Full macro expansion.
expand*[procedure] (expand* FORM)
Returns the full expansion of FROM.
pretty-print-expand*[procedure] (pretty-print-expand* FORM)
Pretty-prints the full expansion of FROM.
ppexpand* is a synonym.
Adds the toplevel command ,x* FORM.
csi -R expand-full
Bugs and Limitations
expand-full simply invokes the core expand procedure iteratively until nothing remains to be expanded. Unfortunately, each expand step returns the expansion of the outermost macro only, discarding the syntactic environment used in that expansion.
This means that if the expansion uses any macros that were introduced in the expansion or if it uses macros that are only available within the module in which the macro was defined, the next expansion step won't know about these macros, and will fail to expand correctly.
The upshot of all this is that expand-full is only useful for expansion of trivial macros. More specifically, it works only for macros that expand only to other top-level macros. This includes recursive macros which expand to self-invocations. Unfortunately, this is a fundamental limitation of the core expand form, which means it's an unfixable problem for this egg.
- Initial release.
Copyright (C) 2009 Kon Lovett. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.