Declarations, especially type and function declarations, increase the efficiency of the compiled code. For example, for the following Lisp source file, with two Common-Lisp declarations added,
(eval-when (compile) (proclaim '(function tak (fixnum fixnum fixnum) fixnum)) (defun tak (x y z) (declare (fixnum x y z)) (if (not (< y x)) z (tak (tak (1- x) y z) (tak (1- y) z x) (tak (1- z) x y))))
The compiler generates the following C code:
/* local entry for function TAK */ static int LI1(register int V1,register int V2,register int V3) { VT3 VLEX3 CLSR3 TTL: if (V2 < V1) { goto L2;} return(V3); L2: { int V5; V5 = LI1((V1)-1,V2,V3); { int V6; V6 = LI1((V2)-1,V3,V1); V3 = LI1((V3)-1,V1,V2); V2 = V6; V1 = V5;}} goto TTL; ;;; Note: Tail-recursive call of TAK was replaced by iteration. }