Replacing elements in a list

Discussion of Common Lisp
Lispoman
Posts: 12
Joined: Mon Jun 01, 2009 6:09 pm

Re: Replacing elements in a list

Post by Lispoman » Wed Jun 10, 2009 3:17 am

Nope I say it again... It isnt homework

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Replacing elements in a list

Post by Paul Donnelly » Wed Jun 10, 2009 1:17 pm

Lispoman wrote:Nope I say it again... It isnt homework
Then why in the world are you so obsessed with this? LAMBDA isn't something you just “modify a function with” — what you say you want to do makes absolutely no sense that I can see. :| Could you describe the intended effect of this modification in more detail?

gugamilare
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil
Contact:

Re: Replacing elements in a list

Post by gugamilare » Wed Jun 10, 2009 6:29 pm

Lispoman wrote:Nope I say it again... It isnt homework
The reason people here is thinking that this is homework is that no one is understanding what exactly you want, what you are saying makes no sense. When someone say something that makes no sense it usually means that that person got an exercise wrong.

Perhaps what you want is to use mapcar to avoid recursion?

Code: Select all

(defun myfunc (x)
  (mapcar (lambda (elt)
            (if (< elt 0)
                (intern (format nil "*~a" elt))
                elt))
          x))

Post Reply