macro-level
2012-10-13
MACRO-LEVEL is an embarassingly trivial convenience macro that saves on indentation while being more concise and direct. (macro-level ...) == (macrolet ((m () ...)) (m))
Author
Jean-Philippe Paradis <hexstream@gmail.com>
License
Public Domain
Project's home: http://www.hexstreamsoft.com/projects/macro-level/
MACRO-LEVEL is an embarassingly trivial convenience macro that saves
on indentation while being more concise and direct.
(macro-level
...)
==
;; Canonical indentation. MACRO-LEVEL saves 11 spaces.
(macrolet ((m ()
...))
(m))
==
;; "Miser" indentation. MACRO-LEVEL saves 5 spaces.
(macrolet
((m ()
...))
(m))
When used as part of a macroexpansion, MACRO-LEVEL also conveniently
relieves the macro implementor from naming and using a gensym for the
one-shot macro when compared to writing out a MACROLET by hand, in
addition to the other advantages.
To use MACRO-LEVEL, simply (macro-level:macro-level ...) after loading
the ASDF system, as this macro is not used that often and the length
won't have any effect on the indentation:
(macro-level:macro-level
...)
VS
(macro-level
...)
Simply (:import-from #:macro-level #:macro-level) in your DEFPACKAGE
if you prefer the latter form. Don't (:use)!
Support could eventually be added to Slime so that interactive
macroexpansion of MACRO-LEVEL calls with C-c C-m (slime-expand-1)
would show the same expansion as interactively macroexpanding (m ...)
after (defmacro m () ...), assuming the lexical context is not
important.
This library is in the Public Domain.
See the UNLICENSE file for details.