On Oct 8, 2010, at 5:09 PM, Paul wrote:
> I'm trying to parse a map unto a URI string, e.g:
>
> {:apple "green", :cherry "red", :banana "yellow"} into
> "apple=green&cherry=red&banana=yellow"
(use 'clojure.string)
(def kvs {:apple "green", :cherry "red", :banana "yellow"})
(join "&"
(map
(fn [[k v]]
(format "%s=%s" (name k) v))
kvs))
(format) is great for building strings out of a mix of bare string values and
other expressions.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en