I normally either do something like this:

(apply str (concat ["a" "b"]
                            (map name :c :d)
                            ["e" "f"]))

Or use java's StringBuilder, it's a mutable black box, but appending is
pretty efficient, and doesn't involve the creation of a ton of seqs like
the above method does.

Timothy

On Thu, Feb 26, 2015 at 12:39 PM, Cecil Westerhof <cldwester...@gmail.com>
wrote:

> At the moment I have the following code:
>     (str "<html>"
>          "<table border='1' cellpadding='10'"
>          "style='font-family:Arial; font-size:16px; margin:
> 10px;width:100%'>"
>          "<tr>"
>          "<th bgcolor='black' color='white'>Quote</th>"
>          "<th bgcolor='black' color='white'>Author</th>"
>          "</tr>")
>
> But I want to make it more generic: the th lines should be data-driven.
> There is a headers variable and when this contains:
>     '(:quote "Quote" :author "Author")
>
> Then the above should be generated. So for every odd position (counting
> from 0) a th string should be inserted. How would I do this?
>
> --
> Cecil Westerhof
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [no subject] Cecil Westerhof
    • Re: Timothy Baldridge
      • Re: Cecil Westerhof
    • Re: Colin Yates
      • Re: Cecil Westerhof
        • Re: Colin Yates
    • Re: Cecil Westerhof

Reply via email to