The dorun in this function (defn process-file "Process csv file and prints first item in every row" [file-name] (let [data (slurp file-name) rows (parse-csv data)] (dorun (map #(println (first %)) rows))))
causes each row of vectors in rows to be processed. (doseq [a-row rows] (println a-row) ) would print each row in the data, which looks like this (the real data, not the test data I've been using today.) "MeterID","Reading","ReadingDateTime","Account","CustomerLN","CustomerFN","DeviceID","DeviceType","ChannelNumber","DecodeType","LoadDateLocal","PremiseID" 33891715,101100,"2011-06-05 23:00:00","610160000","SMITH","E & J", 80581200,43,0,75,"2011-06-06 06:00:01","610160000" 33891773,411200,"2011-06-05 23:00:00","610159000","COMMONER","A", 80598726,43,0,75,"2011-06-06 06:00:01","610159000" 33891887,133100,"2011-06-05 23:00:00","610158000","JONES","J & M", 80581189,43,0,75,"2011-06-06 06:00:01","610158000" 33891825,239400,"2011-06-05 23:00:00","610157000","SAWTOOTH","GEORGE C",80598731,43,0,75,"2011-06-06 06:00:01","610157000" It would be nice if the let statement would allow populating a local variable from iterating all the rows of vectors. I just can't figure out how to do it. On Jun 30, 3:28 pm, Mark Rathwell <mark.rathw...@gmail.com> wrote: > Not sure what you mean by 'row of vectors', and 'break up each row'. > > On Thu, Jun 30, 2011 at 3:20 PM, octopusgrabbus > <octopusgrab...@gmail.com>wrote: > > > > > > > > > If I have rows of vectors, such as the return from clojure-csv\parse- > > csv > > > ["a" 1 "b" 2 "c" 3 "d" 4] > > ["e" 5 "f" 6 "g" 7 "h" 8] > > > How can I break up each row? > > > I've tried doseq in the let statement, but get an error. > > > On Jun 30, 2:27 pm, octopusgrabbus <octopusgrab...@gmail.com> wrote: > > > Thanks. That did it. > > > > On Jun 30, 1:22 pm, Mark Rathwell <mark.rathw...@gmail.com> wrote: > > > > > One way would be: > > > > > (defn map-func > > > > "test map function" > > > > [] > > > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > > > read-map (apply hash-map mtr-seq) > > > > (println read-map))) > > > > > On Thu, Jun 30, 2011 at 1:09 PM, octopusgrabbus < > > octopusgrab...@gmail.com>wrote: > > > > > > Given this function > > > > > > (defn map-func > > > > > "test map function" > > > > > [] > > > > > (let [mtr-seq (vector "a" 1 "b" 2 "c" 3 "d" 4) > > > > > read-map (<how to load key and value from mtr-seq>) > > > > > (println read-map))) > > > > > > I want to load read-map with the keys and values from mtr-seq. > > > > > > Eventually, this data is going to be from the return from parse-csv > > > > > (clojure-csv), but I seem to be making more progress using simpler > > > > > examples. > > > > > > The "a", "b", and so on represent a character string premise id, and > > > > > the 1, 2, and so on represent a meter read. > > > > > > My goal is to create a map, and then pass that around in other > > > > > functions. > > > > > > Thanks. > > > > > cmn > > > > > > -- > > > > > 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 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 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