Practical CL ch3 error

Discussion of Common Lisp
Post Reply
jwm-art
Posts: 9
Joined: Wed May 20, 2009 2:24 pm
Location: Canterbury, Kent, England
Contact:

Practical CL ch3 error

Post by jwm-art » Wed May 20, 2009 2:39 pm

Hi,

I've just begun to learn Lisp, and have been coding in C/C++ and PHP for a few years. I'm running Clisp in Debian GNU/Linux (x86_64) and am working through the book "Practical Common Lisp"...

I copy the function from page 31:

Code: Select all

(defun update (selector-fn &key title artist rating (ripped nil ripped p))
    (setf *db*
        (mapcar
        #'(lambda (row)
            (when (funcall selector-fn row)
                (if title   (setf (getf row :title)     title))
                (if artist  (setf (getf row :artist)    artist))
                (if rating  (setf (getf row :rating)    rating))
                (if ripped-p(setf (getf row :ripped)    ripped)))
            row) *db*)))
into a file, and then load it like so:

Code: Select all

james@scrapyard:~/Lisp$ clisp -repl cd_db.lsp 

*** - DEFUN: Invalid lambda list element (RIPPED NIL RIPPED P)
The following restarts are available:
SKIP           :R1      skip (DEFUN UPDATE # ...)
STOP           :R2      stop loading file /home/james/Lisp/cd_db.lsp
Break 1 [6]> 
and just don't have a clue what is wrong there. Seeing as I'm still at chapter 3, very little has sunk in yet :( But I've heard I need to be patient. Any ideas as to what's wrong here?
TIA.

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

Re: Practical CL ch3 error

Post by gugamilare » Fri May 22, 2009 8:55 am

Somehow the hyphen disappeared. Substitute ripped p for ripped-p (with an hyphen).

jwm-art
Posts: 9
Joined: Wed May 20, 2009 2:24 pm
Location: Canterbury, Kent, England
Contact:

Re: Practical CL ch3 error

Post by jwm-art » Fri May 22, 2009 9:38 am

Sorry for that, I was tired, and did not spot the missing hyphen until after I posted and it was way-past my bed-time. Honestly, I'll try harder in future before I post. Still getting used to typing hyphens within names.

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

Re: Practical CL ch3 error

Post by gugamilare » Fri May 22, 2009 2:03 pm

jwm-art wrote:Sorry for that, I was tired, and did not spot the missing hyphen until after I posted and it was way-past my bed-time. Honestly, I'll try harder in future before I post. Still getting used to typing hyphens within names.
Nothing to apologize for. We are here to help ;)

Post Reply