I want to write a recursive program which can counts the number of atoms
that occur in a list at all level, for example:
>(ALL-LENGTH '(A B C))
>3
>(ALL-LENGTH '(A (B C) D (E)))
>5
But my program have some bug and I can't find where to correct it. Hope
somebody can help me to correct it.
Thank you very much.
(DEFUN ALL-LENGTH (lst)
(IF (NULL lst) 0
(+ 1
(COND ((AND (LISTP (CAR lst)) (>= 2 (LENGTH(CAR lst)))) (ALL-LEN
(CAR lst)))
( T (ALL-LENGTH (CDR lst))))))
)