Thanks for your answer, David: Eventually, I came back from reading a .csv file using a generic method to closure-csv, and got help wrapping my mind around the data I was getting back from closure-csv/parse and how to pull that apart to get what I wanted.
I was also stuck on the notion of having to supply lazy-io as part of using clojure-csv. I had forgotten that in your notes you had specified the parse method uses lazy-io. tnx cmn On Jun 17, 12:12 pm, David Santiago <david.santi...@gmail.com> wrote: > Also, you don't want to simply split the CSV into lines by looking for > newlines. CSVs can contain newlines quoted in fields, so you need to > actually parse the CSV with quoting to figure out the line breaks for > the file format and ignore the line breaks in the fields. > > - David > > > > > > > > On Fri, Jun 17, 2011 at 9:21 AM, Mark Rathwell <mark.rathw...@gmail.com> > wrote: > > > Some resources, in case they help: > > 1. http://clojuredocs.org/ has documentation for core and contrib, and often > > has examples > > 2. http://clojure.org has a lot of reading material about the language, > > including a nice cheat sheet (http://clojure.org/cheatsheet) > > 3. http://www.clojureatlas.com offers a unique way to navigate between the > > pieces of the clojure language > > 4. if you are at a REPL, you can use the doc macro to read function doc > > strings: > > user> (doc map) > > ------------------------- > > clojure.core/map > > ([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]) > > Returns a lazy sequence consisting of the result of applying f to the > > set of first items of each coll, followed by applying f to the set > > of second items in each coll, until any one of the colls is > > exhausted. Any remaining items in other colls are ignored. Function > > f should accept number-of-colls arguments. > > nil > > > On Fri, Jun 17, 2011 at 9:13 AM, octopusgrabbus <octopusgrab...@gmail.com> > > wrote: > > >> Many thanks. I didn't recognize the % symbol is used similarly to the > >> way it's used in printf and constructing SQL query string. > > >> On Jun 17, 9:07 am, Ken Wesson <kwess...@gmail.com> wrote: > >> > On Fri, Jun 17, 2011 at 8:57 AM, octopusgrabbus > > >> > <octopusgrab...@gmail.com> wrote: > >> > > I'm trying this in REPL > > >> > > timmy=> (def ox [1 2 3 4]) > >> > > #'timmy/ox > >> > > timmy=> ox > >> > > [1 2 3 4] > >> > > timmy=> (map #(reduce str/split (seq ox) #",")) > >> > > java.lang.IllegalArgumentException: Wrong number of args (1) passed > >> > > to: core$map (NO_SOURCE_FILE:0) > >> > > t > > >> > Yikes. > > >> > Well, first of all, you need to > > >> > (map #(str/split % #",") some-seq-of-strings) > > >> > -- map takes a function and then one or more sequences or collections > >> > to iterate over. Further, the function needs to have an argument; with > >> > #() closures you use % to stand in for the element from the sequence. > >> > So > > >> > (map #(* 2 %) ox) > > >> > in your case would return > > >> > (2 4 6 8) > > >> > as a lazy sequence. > > >> > Lastly, though, ox doesn't contain strings so str/split can't be used > >> > on them. And I don't know why you had a "reduce" in there. > > >> > -- > >> > Protege: What is this seething mass of parentheses?! > >> > Master: Your father's Lisp REPL. This is the language of a true > >> > hacker. Not as clumsy or random as C++; a language for a more > >> > civilized age. > > >> -- > >> 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 first post. > >> 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 > > > -- > > 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 > > first post. > > 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 -- 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 first post. 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