Apologies for my ignorance ,i am new to clojure, but can you give an example of what the code should look like. I understand my-row-data is lexical as it defined outside the function but i don't understand how to implement this new function. tks, PJ
On Apr 2, 1:03 pm, Laurent PETIT <laurent.pe...@gmail.com> wrote: > You're holding the head, because my-row-data is defined in the lexical or > dynamic scope of the function, and holds the head. > > Try creating a function returning the seq that is currently stored in > my-row-data and call it instead : (my-row-data) > > -- > Laurent > > 2009/4/2 fitzpatrick...@googlemail.com <fitzpatrick...@googlemail.com> > > > > > Hi, > > Thanks for the replies. > > > I have adapted the code above with my example. I still get the heap > > error! > > my-row-data is the lazy sequence. each element in the seq is a 2 > > element vector of Java String[] > > output-array is just a printing function for the String[]. For > > convenience i place a @ between the two outputs. > > > (defn t [file-name] > > (with-open [w (java.io.FileWriter. (java.io.File. file-name))] > > (doseq [l my-row-data] > > (.write w (str (output-array (first l) ",") > > "@" > > > (output-array (second l) ",") > > > "\n") > > > ) > > ) > > ) > > ) > > > tks, > > PJ > > > On Apr 2, 12:15 pm, Christian Vest Hansen <karmazi...@gmail.com> > > wrote: > > > On Thu, Apr 2, 2009 at 11:58 AM, fitzpatrick...@googlemail.com > > > > <fitzpatrick...@googlemail.com> wrote: > > > > > Hi, > > > > I am attempting to print a large lazy seq to file. I have attempted > > > > various approaches and obviously am missing something obvious. > > > > I have attempted do use do-seq and also iterated manually through the > > > > sequence but i always come up with the heap error. > > > > Has anyone got any suggestions? > > > > Don't hold on to the head of the seq. > > > > It may not be obvious where, but you are most likely holding on the > > > the head of the seq, which prevents the elements from being GC'd as > > > you iterate them. > > > > > tks, > > > > PJ > > > > -- > > > Venlig hilsen / Kind regards, > > > Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---