This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Practical CL ch3 error

4 posts · 2659 views

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:
(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:
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.

Re: Practical CL ch3 error

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

Re: Practical CL ch3 error

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.

Re: Practical CL ch3 error

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 ;)