On Thu, Jun 30, 2011 at 4:15 PM, octopusgrabbus <octopusgrab...@gmail.com> wrote: > 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.
So you just want a variable bound to a flat list of the things in the vectors, or of the vectors themselves? (let [x seq-of-vectors]) will accomplish the latter, and (let [x (apply concat seq-of-vectors)]) the former. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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