Re: Using clojure-csv with large files

2012-07-08 Thread Timothy Washington
Hmm, these are all good points. My source file just returns the sequence (as in *src.clj*). I have a midje test file (*test.clj*) that just asserts that it exists. *src.clj * (ns my-ns ... ) (defn load-config [] (let [config (load-file "etc/config.clj") dname (-> config :data :test)]

Re: Using clojure-csv with large files

2012-07-08 Thread Dustin Getz
what are you doing with the return value of csv/parse-csv? -- 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 firs

Re: Using clojure-csv with large files

2012-07-08 Thread Sean Corfield
On Sun, Jul 8, 2012 at 9:34 AM, Timothy Washington wrote: > I'm trying out the Clojure-csv lib. But I run out of heap space when trying > to parse a large CSV file. So this call should return a lazy sequence. > > (csv/parse-csv (io/reader "125Mfile.csv")) If you are consuming the CSV lazily, you

Re: Using clojure-csv with large files

2012-07-08 Thread David Santiago
Yeah, CSV files can have embedded newlines, so you can't just split it up on linebreaks and expect it to work, you need to send them through a parser. parse-csv *is* lazy, so my question is, are you doing this at the repl, exactly as you wrote? If so, it will lazily parse the file, and then print

Re: Using clojure-csv with large files

2012-07-08 Thread Denis Labaye
Hi, I would try something like (untested): (map parse-csv (line-seq (clojure.java.io/reader "/tmp/foo.csv"))) But it will break for CSV cells with newlines like: a ; b foo;"bar baz" x ; z interesting ... Denis On Sun, Jul 8, 2012 at 6:34 PM, Timothy Washington wrote: > Hi there, > >

Re: Using clojure-csv

2011-06-15 Thread .Bill Smith
The indentation made it confusing, but the (use ...) was outside of the (ns ...). I had the same initial reaction, especially since i prefer (:use) over (use) except when typing code into the REPL. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To

Re: Using clojure-csv

2011-06-15 Thread octopusgrabbus
Thanks. It wasn't on the CLASSPATH. On Jun 14, 3:41 pm, David Santiago wrote: > I think the basic problem is Clojure is not able to find the > clojure-csv jar file. I'm afraid I'm not quite clear enough on your > specific setup to know exactly what has gone wrong. I'm not sure where > you have th

Re: Using clojure-csv

2011-06-14 Thread David Santiago
I think the basic problem is Clojure is not able to find the clojure-csv jar file. I'm afraid I'm not quite clear enough on your specific setup to know exactly what has gone wrong. I'm not sure where you have this jar, or what exactly the shell scripting stuff is in that command you're using to lau

Re: Using clojure-csv

2011-06-14 Thread Ken Wesson
On Tue, Jun 14, 2011 at 3:26 PM, octopusgrabbus wrote: > This fails: > > (ns test-csv >  (:import (java.io BufferedReader))) >  (use clojure-csv.core) > > with java.lang.ClassNotFoundException: clojure-csv.core > (NO_SOURCE_FILE:6) > > What am I doing wrong? One thing that stands out is that it s

Re: Using clojure-csv

2011-06-14 Thread octopusgrabbus
In regards to the extra_classpath question, this is what Synaptic installed in /usr/bin/clojure #!/bin/sh if [ "x$CLASSPATH" = "x" ] ; then extra_classpath="" else extra_classpath=":$CLASSPATH" fi while true ; do case "$1" in -cp | -classpath)

Re: Using clojure-csv

2011-06-14 Thread octopusgrabbus
Thanks. You've answered my question. I've got to set up a real projects directory and build the jar file. I appreciate everyone's patience during this "cockpit error" phase of my learning Clojure. On Jun 14, 4:04 pm, Chas Emerick wrote: > clojure-csv is not a part of clojure-contrib.  What is at

Re: Using clojure-csv

2011-06-14 Thread Chas Emerick
clojure-csv is not a part of clojure-contrib. What is at $extra_classpath? For this to work, it would need to include the jar for clojure-csv. - Chas P.S. Mostly off-topic: the sooner you can get away from whatever re-packaging your distro has put together for Clojure, the better off you'll b