Honestly I would prefer to encapsulate everything in a mathematical
function, not a (case ... ) or (cond ...) function. I would explicitly
use log, expt, floor... In my opinion it makes the code clearer - for
instance, it would show more humanly how the damage grows as the attack
power increases - exponencially? linearly?
Anyway, it's just a suggestion, I'm not disagreeing with your method to create the program neither saying it is wrong.
You are probably right that I could get around it by refactoring, and I
may end up doing that. However I suspect it's more than a design issue
-- as I said, other compilers (Clozure, Allegro) and even clisp have no
problems with it, whereas SBCL's memory footprint goes from <100MB to
>500MB when compiling this function.
Changing SAFETY to 0 in the declaim statement seems not to make any