(apply clojure.string/join “," (vals my-map)) would work but you can’t
guarantee the order.
(map (fn [{:keys [name city]}] (clojure.join/string “,” [name city]))) my-map)
gives you control of the order in which the fields are processed.
You could also look at juxt as well?
> On 23 Oct 2015, at 12:49, r/ Wobben <[email protected]> wrote:
>
> Hello,
>
> As a challenge I need to convert a map structure to a csv structure.
>
> So ( { :name "roelof", :city secret }) need to be converted to roelof, secret.
>
> I think I can use something like (map clojure.string/join ..) for it but it
> seems I have to make a function out of the :name roelof part to get roelof
> back.
>
> I could use get for then I do not know how to call 1 records of the whole
> map.
>
> Can someone explain in simple English how I can solve this one ?
>
> --
> 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
> <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 [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.