Replacing elements in a list

Discussion of Common Lisp

Re: Replacing elements in a list

Postby Lispoman » Wed Jun 10, 2009 3:17 am

Nope I say it again... It isnt homework
Lispoman
 
Posts: 12
Joined: Mon Jun 01, 2009 6:09 pm

Re: Replacing elements in a list

Postby 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?
Paul Donnelly
 
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: Replacing elements in a list

Postby 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))
gugamilare
 
Posts: 406
Joined: Sat Mar 07, 2009 6:17 pm
Location: Brazil

Previous

Return to Common Lisp

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron