Given this test program:
(ns test-csv
(:gen-class)
(:use clojure.contrib.command-line)
(:use clojure-csv.core))
(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))))
(defn -main [& args]
(with-command-line args
"Get csv file name"
[[file-name ".csv file name" 1]]
(println "file-name:", file-name)
(if file-name
(process-file "resultset.csv")
(process-file file-name))))
is it reasonable to write a recursive function that takes the lazy
sequence -- rows -- (returned from clojure-csv) and column numbers and
recurses until the appropriate column number is reached, or is it
better to build up a long series of expressions that would pull the
columns out?
For example, I believe I can pull out the second column by specifying
(first (next rows)), but it would look pretty awful to create a long
enough expression to get the 6th column in.
--
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