Page 1 of 1

weird lisp loop type operation

Posted: Thu Sep 15, 2011 5:50 am
by galosi198
Why does the function

(defun counter (list)
(if (null list)
0
(+ 1 ( name (cdr list) )
)
)

loop?

I can't quite see how the self-calling of counter works either.

Re: weird lisp loop type operation

Posted: Thu Sep 15, 2011 7:55 am
by ramarren
Please use code tags for formatting code.

(name ...) is not a standard Common Lisp function. As shown, the counter doesn't loop by itself.