AccelerationNet/function-cache

STYLE-WARNING when defining recursive cached functions

samebchase opened this issue · 2 comments

PLAYGROUND> (function-cache:defcached factorial-rec (x)
              (if (= x 0)
                  1
                  (* x (factorial-rec (1- x)))))
; in: DEFCACHED FACTORIAL-REC
;     (FNCACHE.PLAYGROUND::FACTORIAL-REC (1- FNCACHE.PLAYGROUND::X))
; 
; caught STYLE-WARNING:
;   undefined function: FACTORIAL-REC
; 
; compilation unit finished
;   Undefined function:
;     FACTORIAL-REC
;   caught 1 STYLE-WARNING condition
FACTORIAL-REC

In this line, we see that the memoization happens after the defun, whereas in cache.lisp, the caching is happening within the defun.

Thanks so much for pointing this out, I appreciate you taking the time to contribute