I\'ve written a Lisp function like this:
(defun power (base exponent)
(if (= exponent 0)
1
(* base (power (- exponent 1)))))
Wh
Compile your functions. In LispWorks use c-sh-c to compile a definition in the editor.
Here in the REPL:
CL-USER 18 > (defun power (base exponent)
(if (= exponent 0)
1
(* base (power (- exponent 1)))))
POWER
CL-USER 19 > (compile 'power)
;;;*** Warning in POWER: POWER is called with the
;;; wrong number of arguments: Got 1 wanted 2
The Compiler will already tell you that there is a problem with the code.
Note that the LispWorks Listener (the REPL) does not compile. You have to compile the definitions you enter at the Listener with the function COMPILE. Alternatively you can type the definitions into an editor window and compile it from there (by either compiling the file, the buffer or the expression). LispWorks also has features to locate code where an error happens.