(defun freq (e L)
(cond
((not (listp L)) nil)
((null L) 0)
((equalp e (car L)) (+ 1 (freq e (cdr L))))
(t (freq e (cdr L)))))
|
You are to implement a tail-recursive version, by using an extra parameter to keep track of the number of instances counted so far.