In the following program, is the scope of the command line arguments
-- args --  local to with-command-line, or can they be accessed
outside with-command-line?

I think they are local to with-command-line.

(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))));

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

Reply via email to