Check out Bike's compiler-macro library, specifically the `form-type` function: https://github.com/Bike/compiler-macro
On Mon, Nov 6, 2017 at 3:43 PM, Chaitanya Gupta <[email protected]> wrote: > Let's say I have created a function called `FOO`: > > (defun foo (x) > ...) > > To optimize this function, I write a compiler macro. Can I make use of > type declarations that users of `FOO` might have made for the argument > `X` that is passed in to it? > > That is, let's say `FOO` is used like this: > > (let ((a (something-that-returns-an-integer))) > (declare (integer a)) > (foo a)) > > The compiler macro for `FOO` cannot make any optimizations on the > value of `A`, but can it take advantage of the fact that `A` is > declared as in `INTEGER` here? > > Chaitanya >
