On Thu, Jun 16, 2011 at 6:07 PM, octopusgrabbus
octopusgrab...@gmail.com wrote:
This Clojure program:
ns test-csv
(:require [clojure.contrib.string :as str])
(:import (java.io BufferedReader FileReader StringReader))
(:use clojure-csv.core))
(defn process-file [file-name]
Thanks for the reply. In this instance, what's the syntax for map? I'm
trying in REPL and getting a wrong number of arguments (1) passed to
core$map.
On Jun 17, 7:11 am, Ken Wesson kwess...@gmail.com wrote:
On Thu, Jun 16, 2011 at 6:07 PM, octopusgrabbus
octopusgrab...@gmail.com wrote:
Hi
On 17 June 2011 00:07, octopusgrabbus octopusgrab...@gmail.com wrote:
This Clojure program:
ns test-csv
(:require [clojure.contrib.string :as str])
(:import (java.io BufferedReader FileReader StringReader))
(:use clojure-csv.core))
[...]
I am having trouble figuring out where to
I'm used to using the Python csv package and how that returns lines
from a csv. I could not get clojure-csv to split up the line the way I
wanted, and also thought about how to clojure.string/split the line.
Right now at the repl, I cannot figure out the syntax just to use map
on a sequence of
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
On Jun 17, 8:55 am, octopusgrabbus octopusgrab...@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
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
non-lazy version:
(map #(vec (.split % ,))
(vec (.split (slurp /tmp/foo.csv) \n)))([foo
bar] [fu bor])
On Fri, Jun 17, 2011 at 2:39 PM, octopusgrabbus octopusgrab...@gmail.comwrote:
Thanks for the reply. In this instance, what's the syntax for map? I'm
trying in REPL and
Some resources, in case they help:
1. http://clojuredocs.org/ has documentation for core and contrib, and often
has examples
http://clojuredocs.org/2. http://clojure.org has a lot of reading material
about the language, including a nice cheat sheet (
http://clojure.org/cheatsheet)
3.
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,
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
BTW I changed (:require [clojure.contrib.string :as str]) to (:require
[clojure.string :as str]) and the problem persists.
On Jun 16, 6:07 pm, octopusgrabbus octopusgrab...@gmail.com wrote:
This Clojure program:
ns test-csv
(:require [clojure.contrib.string :as str])
(:import (java.io
12 matches
Mail list logo