[cl-who-devel] dolist

Stas Boukarev stassats at gmail.com
Tue Feb 28 15:00:08 UTC 2012


"Haris Bogdanovich" <fbogdanovic at xnet.hr> writes:

> Hi.
>
> This is my code:
>
> (defun index ()
>   (with-html-output-to-string (*standard-output* nil :prologue t)
>     (:html
>      (:head)
>      (:body
>       (:select
>        (dolist (var '("citroen" "volvo" "audi"))
>          (format nil ("(:option %s" var))))))))
>
> I get error:
>  Funny car of form: "(:option %s
> What's wrong ?

(format nil ("(:option %s" var))) doesn't look like valid Common Lisp, I
would expect at least (format nil "(:option %s" var)), but it wouldn't
do what you want. 

The correct thing would be

(defun index ()
  (cl-who:with-html-output-to-string (*standard-output* nil :prologue t)
    (:html
     (:head)
     (:body
      (:select
       (dolist (var '("citroen" "volvo" "audi"))
         (htm (:option (str var)))))))))

-- 
With best regards, Stas.




More information about the Cl-who-devel mailing list