Thanks, 

I tried it like this : 

(defn convert-back
    "converts the map back to a csv string"
      [{:keys [name, city]}, records ]
      (map (fn [{:keys [name city]}] (clojure.join/string “,” [name 
city]))) records)  

and then I do : (convert-back {:name "roelof" :city: secret}, { :name "X" 
:city "Earth"} )

and I see this error when running in repl : 

#error {
 :cause clojure.join
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message java.lang.ClassNotFoundException: clojure.join, 
compiling:(chapter_4/core.clj:56:47)
   :at [clojure.lang.Compiler analyzeSeq Compiler.java 6730]}
  {:type java.lang.ClassNotFoundException
   :message clojure.join
   :at [java.net.URLClassLoader$1 run URLClassLoader.java 366]}]
 :trace
 [[java.net.URLClassLoader$1 run URLClassLoader.java 366]
  [java.net.URLClassLoader$1 run URLClassLoader.java 355]
  [java.security.AccessController doPrivileged AccessController.java -2]

e clojure.join
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message java.lang.ClassNotFoundException: clojure.join, 
compiling:(chapter_4/core.clj:56:47)
   :at [clojure.lang.Compiler analyzeSeq Compiler.java 6730]}
  {:type java.lang.ClassNotFoundException
   :message clojure.join
   :at [java.net.URLClassLoader$1 run URLClassLoader.java 366]}]
 :trace
 [[java.net.URLClassLoader$1 run URLClassLoader.java 366]
  [java.net.URLClassLoader$1 run URLClassLoader.java 355]
  [java.security.AccessController doPrivileged AccessController.java -2]


#error {
 :cause clojure.join
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message java.lang.ClassNotFoundException: clojure.join, 
compiling:(chapter_4/core.clj:56:47)
   :at [clojure.lang.Compiler analyzeSeq Compiler.java 6730]}
  {:type java.lang.ClassNotFoundException
   :message clojure.join
   :at [java.net.URLClassLoader$1 run URLClassLoader.java 366]}]
 :trace
 [[java.net.URLClassLoader$1 run URLClassLoader.java 366]
  [java.net.URLClassLoader$1 run URLClassLoader.java 355]
  [java.security.AccessController doPrivileged AccessController.java -2]

Roelof


(convert-back  {:name "roelof" :glitter-index 2 })(convert-back  {:name 
"roelof" :glitter-index 2 })


Op vrijdag 23 oktober 2015 14:25:44 UTC+2 schreef Colin Yates:
>
> (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 <wobb...@gmail.com <javascript:>> 
> 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 clo...@googlegroups.com <javascript:>
> Note that posts from new members are moderated - please be patient with 
> your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com <javascript:>
> 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+u...@googlegroups.com <javascript:>.
> For more options, visit 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 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.

Reply via email to