Function
common-lisp
compile name &optional definition => name, function
If supplied, this is a lambda-expression to be compiled.
If not supplied, then the lambda-expression used is the current definition of the name (in this case name must be a non-nil symbol with an uncompiled definition).
If notnil, this is the symbol that is to receive the compiled function as its global function definition.
nil the compiled function definition itself. Such compiled-function objects are not printable (but seedisassemble) other than as# <compiled function for SYMBOL>. compile calls the compiler to translate a lambda expression into a code vector containing an equivalent sequence of host specific machine code. A compiled function typically runs between 10 and 100 times faster. It is generally worth compiling the most frequently called Lisp functions in a large application during the development phase. The compiler detects a large number of programming errors, and the resulting code runs sufficiently faster to justify the compilation time, even during development.
(defun fn (...) ...) ; interpreted definition for fn
(compile 'fn ; replace with compiled
; definition
(compile nil '(lambda (x) (* x x)))
; returns compiled squaring function
(compile 'cube '(lambda (x) (* x x x)))
; defun and compile in one
declare for a list of the declarations that alter the behavior of the compiler. compile-filedisassembledeclare