Rob Thorpe <email@example.com> wrote:
| If you write a program that generates some lisp code in CMUCL or GCL
| you could execute the code by evaling it. In SBCL it may be more
| appropriate to evaluate something like "(defun generated (args)
| (...code...))", then call "generated" later in the code. This will
| avoid the compiler compiling it more than once.
Or simply wrap a LAMBDA around the generated code, eval *that*
[thus compiling it], and then FUNCALL the compiled LAMBDA multiple
times inside the timing loop, thus avoiding polluting the global
namespace with things like GENERATED...
Not that since COMPILE is is allow to (and usually will) return
the same object when given an already-compiled object, if you
further wrap a COMPILE around the EVAL (or the LAMBDA, not sure
it matters much which), you get a version that will "do the same thing"
on both compile-all-the-time and interpret-unless-told-to-compile
implementations (e.g., SBCL vs. CMUCL).
Rob Warnock <firstname.lastname@example.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607