Dealing with &rest-parameters in common lisp

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-04-13T22:50:42Z Indexed on 2010/04/13 22:53 UTC
Read the original article Hit count: 197

Filed under:

I want define a functions that accepts &rest - parameters and delegates them to another function.

(html "blah" "foo" baz) => "blahfoobaz"

I did not find a better way than this one:

(defun html (&rest values) (concatenate 'string "" (reduce #'(lambda(a b) (concatenate 'string a b)) values :initial-value "") ""))

But this looks somewhat glumbsy to me, since line 4 does no more than concatenating the &rest parameter "values". I tried (concatenate 'string "" (values-list values) "") but this does not seem to work (SBCL). Could someone give me an advice?

Kind regards

© Stack Overflow or respective owner

Related posts about lisp