Hi,

Newish to clojure and been wrecking my head the last while trying to figure 
this one out.

I have a series of similar xmls which I need to parse through and print out 
the results as a csv to file.

I call the below function at the correct level for the xml parsing, and it 
does parse the xml and create a csv.  If I just write to file at this stage 
it works fine, but I want to add the map to a static hashmap for parallel 
processing, so the below fucntion is called as part of the processing for 
pmap on the xmls.

(defn- parse [ measures id ]
    (let [
    
        result(for [measure measures
              :when (= (zf/xml1-> measure :measureID zf/text) "Samsung")
              entry (zf/xml-> measure :MeasureEntry)]
               (into {} (for [measure-value-set (zf/xml-> entry 
:MeasureValueSet)]
                 {
                  :Benchmark (zf/xml1-> measure-value-set :Benchmark 
zf/text)
                  :Value (zf/xml1-> measure-value-set :Value zf/text)
                  ;:Tenor (last (clojure.string/split (zf/xml1-> 
measure-value-set :Benchmark zf/text) #"\."))
                     ;:Currency (for [dimension (zf/xml-> entry :Dimension)
                       ;            :when (= (zf/xml1-> dimension :type 
zf/text) "Currency")]        
                    ;            (zf/xml1-> dimension :value zf/text))
                   :Currency             (first (zf/xml-> entry :Dimension 
:value zf/text))}
                   )))
    
        measures2(distinct result)
        
      
        Benchmark(map :Benchmark measures2)
        Value(map :Value measures2)
        Currency(map :Currency measures2)
        
        mapfinal(map #(str %1 "," %2 "," %3  "\n" ) Benchmark Value 
Currency)        
        _(error "mapfinal" mapfinal)
        
        ]
        (.put staticMeasureMap id mapfinal)
    ))


I am having trouble outputting the final static hashmap results though.


(spit (str "/tmp/final.txt") (doall (vals staticMeasureMap)))

or

(spit (str "/tmp/final.txt") (apply str (vals staticMeasureMap)))

But all it is returning is clojure.lang.LazySeq@ repeatedly.

Can someone advise on the best way to print out this hashmap to file?

-- 
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