humpolec wrote:I have no problem doing it myself, I just thought Common Lisp had that functionality - even C has it after all.
Hmmm... this is one of those questions that shows you're still holding onto a C-like worldview. That's nothing to be ashamed of, though. I had the same thing when I first started studying Lisp because we're all products of our prior experience. I'd suggest that before you start worrying about code so optimized that ASSERT is compiled out of it, you instead make sure you are starting to operate in a Lisp worldview. The purpose of ASSERT in Lisp is not quite the same as in C.
Specifically, in C, when an assert fails, the only option is for the program to abort. Typically, ASSERTs are only used for debugging and you want to remove them before you ship. With Lisp's phenomenal integrated debugging capabilities, you wouldn't necessarily want to remove the ASSERTs. They are integrated with the condition/restart system and would either provide you with some great debugging information (stack traces, etc.), or would even allow you to resume program execution after you correct the error. If you don't understand conditions and restarts and such, you should probably spend some time on them before you start worrying about ASSERT.
That said, there are numerous ways to go about doing what you want in Lisp. As people have already pointed out, you can use the conditional reader capabilities. That's the closest thing to C's #ifdef capability. So, you could do:
#+assert (ASSERT foo)
If the "assert" symbol was not included in *FEATURES* at the time the compiler read that form, it would not be included.
You could also create your own macro (e.g. MYASSERT) and used that instead, providing a different expansion when it's time to remove it.
In short, there is at least as much flexibility in Lisp as in C. But before you start exercising that, try to hold your C-like worldview in check for a while and ask yourself (and others), "Why does Lisp do things this way?" Remember that Lisp is even older than C (the second-oldest high-level language). It has a rich history and there are typically reasons why something is done the way it is.