Saving Variables While Iterating a Lazy Sequence

To learn Clojure, I’ve been taking one of our water department daily reads reports that we get every morning from our Automated Meter Reading (AMR) vendor. This report comes in the form of a comma separated values (.csv) file, and it is excellent practice for learning Clojure, at least in my opinion.

First stop on this journey should have been setting up the build environment and using either Cake or Leiningen. I did not start there. I have a build environment now, and am happy about that.

The next stop was to create a test program that would load the result.csv file into memory and parse it. I chose clojure-csv as the library, and that so far has proved out to be a very good package, which has two functions, write-csv and parse-csv.

parse-csv returns a list of vectors containing the parsed columns from the .csv file. Here is where things become tricky. I don’t want to print these out right away, although that is nice for debugging, and I want to print out more than one column. That is where I am now, and am slogging my way through now to store these values from the lazy sequence returned from parse-csv. When that is resolved, I’ll add a new post with the results.

Advertisements

Leave a comment

Filed under Clojure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s