[cl-who-devel] loop and with-html-output

Tyler Smith tyler.smith at mail.mcgill.ca
Wed Dec 21 22:16:28 UTC 2011


Hi,

I'm new to lisp in general, trying to get cl-sql and cl-who working
together. I'm stumped in my
efforts to generate a definition list from an sql query. The following
works as expected:

(multiple-value-bind (records fields)
    (select [genus] [species] :from "specimens" :where [= [collector] "Test"])
  (loop for rec in records do
       (loop for label in fields
          for val in rec do
            (fresh-line)
            (print label)
            (print val))))

=>

"GENUS"
"Scleria"

"SPECIES"
"triglomerata"

However, swapping print for with-output-to-html fails:

* (multiple-value-bind (records fields)
    (select [genus] [species] :from "specimens" :where [= [collector] "Test"])
  (loop for rec in records do
       (loop for label in fields
          for val in rec do
            (fresh-line)
            (with-html-output (*standard-output* nil :indent nil)
              (:dt label)
              (:dd val)))))


<dt></dt><dd></dd>
<dt></dt><dd></dd>

What have I missed? Any other suggestions for doing this in a lispier
way would also be
welcome.

Thanks,

Tyler




More information about the Cl-who-devel mailing list