[movitz-devel] Re: &REST variable OBJECTS must be dynamic-extent.

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Sun Apr 17 22:31:34 UTC 2005


Shawn Betts <sabetts at vcn.bc.ca> writes:

> It seems sometimes having a &rest variable in a function causes a
> strange error. Is this a known issue? It's kind of irritating :).

Turned out this could be fixed without too much effort. What I've done
is to have e.g.

  (defun silly-fn (&rest objects)
    (mapcar #'+ objects))

compile as

  (defun silly-fn (&rest objects)
    (declare (dynamic-extent objects))
    (let ((objects (copy-list objects)))
      (mapcar #'+ objects)))


I've not tested it extensively, but I hope it works for you.

-- 
Frode Vatvedt Fjeld




More information about the movitz-devel mailing list