I want to verify if this a recursive function? Needs to return the nth element, mine works I just want to make sure.
(defun nth2(n lst)
(let((count 1))
(loop
(cond((equal count n)(return (car lst))))
(setq count (+ count 1))
(setq lst (cdr lst)))))
Ok. I just tried this idea. It gives me an error: Not inside a block named NIL
(defun nth2(n lst)
(let((count 1))
(cond((equal count n)(return (car lst)))
(t(setq count (+ count 1))
(nth2(count (cdr (lst))))))))
nth2inside the definition ofnth2.