- Code: Select all
(defun add (number)
(intern (format nil "*~a" number)))
(defun myfunc (x)
(cond ((null x) nil)
((< (car x) 0) (cons (add (car x)) (myfunc (cdr x))))
(T (cons (car x) (myfunc (cdr x))))))
Why so recursive?
Lispoman wrote:Now the question can lisp differ even and odd numbers? And how can the function above be modified to use with lambda?
You can use EVENP or ODDP as you prefer, or you can use MOD, as you could in any language. I don't know what you mean by modifying it to use with lambda.