Best Way To Extract Data From Lazy Sequence

2011-06-28 Thread octopusgrabbus
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 (f

Re: Best Way To Extract Data From Lazy Sequence

2011-06-28 Thread Alex Robbins
If you are trying to get the 6th row, you might use the "nth" function. It allows you to grab an element based on its index. That'd be better than tons of (next (next (next rows))) stuff. user=> (doc nth) - clojure.core/nth ([coll index] [coll index not-found]) Returns th

Re: Best Way To Extract Data From Lazy Sequence

2011-06-28 Thread octopusgrabbus
Thanks. That works perfectly. (ns test-csv (:gen-class) (:use clojure.contrib.command-line) (:use clojure-csv.core)) (defn x1 [val1 val2] (println val1 val2)) (defn process-file "Process csv file and prints a column in every row" [file-name] (let [data (slurp file-name)