LispWorks User Guide and Reference Manual > 9 The Compiler

NextPrevUpTopContentsIndex

9.1 Compiling a function

The function compile takes a symbol as its first argument, and an interpreted function definition (a lambda expression) as its second, optional, argument. It compiles the definition and installs the resultant code as the symbol-function of the symbol (unless the symbol was nil ). If the definition is omitted then the current symbol-function of the symbol is used. Below are some examples:

CL-USER 3 >  (compile (defun  fred (a b)
 
                       (dotimes (n a) (funcall b)))) 
; FRED
FRED
NIL
NIL
 
CL-USER 4 >  (funcall (compile nil '(lambda (n)                              
                     (* n n)))  7)
; NIL 
49
 
CL-USER 5 >  (compile  'ident-fun  '(lambda (x) x)) 
;IDENT-FUN 
IDENT-FUN
NIL
NIL

LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex