The clojure.contrib.string namespace contains many function names which are
already defined clojure.core. So, by :use-ing clojure.contrib.string, you
will be replacing the core functions with the string functions. Rarely do
you really want to do this. It is generally best to :require instead of
:use.
so something like:
(ns test-csv
(:gen-class)
(:import (java.io BufferedReader FileReader StringReader))
(:use clojure-csv.core)
(:require [clojure.contrib.string :as string]))
(defn process-file [file-name]
(with-open [br (BufferedReader. (FileReader. file-name))]
(println (string/split (line-seq br)",")))
(defn -main [& args]
(process-file "resultset.csv"))
On Thu, Jun 16, 2011 at 5:37 PM, octopusgrabbus <[email protected]>wrote:
> I don't know what I'm doing wrong. After adding (:use
> clojure.contrib.string) to
>
> (ns test-csv
> (:gen-class)
> (:import (java.io BufferedReader FileReader StringReader))
> (:use clojure-csv.core)
> (:use clojure.contrib.string))
>
>
> (defn process-file [file-name]
> (with-open [br (BufferedReader. (FileReader. file-name))]
> (println (split (line-seq br)",")))
>
> (defn -main [& args]
> (process-file "resultset.csv"))
>
> I'm getting these errors on compile:
>
> [compile] Compiling namespace test-csv
> WARNING: repeat already refers to: #'clojure.core/repeat in namespace:
> test-csv, being replaced by: #'clojure.contrib.string/repeat
> WARNING: butlast already refers to: #'clojure.core/butlast in
> namespace: test-csv, being replaced by: #'clojure.contrib.string/
> butlast
> WARNING: reverse already refers to: #'clojure.core/reverse in
> namespace: test-csv, being replaced by: #'clojure.contrib.string/
> reverse
> WARNING: get already refers to: #'clojure.core/get in namespace: test-
> csv, being replaced by: #'clojure.contrib.string/get
> WARNING: partition already refers to: #'clojure.core/partition in
> namespace: test-csv, being replaced by: #'clojure.contrib.string/
> partition
> WARNING: drop already refers to: #'clojure.core/drop in namespace:
> test-csv, being replaced by: #'clojure.contrib.string/drop
> WARNING: take already refers to: #'clojure.core/take in namespace:
> test-csv, being replaced by: #'clojure.contrib.string/take
> error evaluating:
> ((compile-stale source-path compile-path))
> java.lang.RuntimeException: java.lang.Exception: EOF while reading
> (test_csv.clj:15)
> .
> .
> .
>
> What am I doing wrong?
> tnx
> cmn
> On Jun 16, 5:16 pm, Damon Snyder <[email protected]> wrote:
> > Hi cmn,
> > I think if you add clojure.contrib.string to your use or simply add
> > (:use clojure.contrib.string). I think that should fix it.
> >
> > Damon
> >
> > On Jun 16, 12:16 pm, octopusgrabbus <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > What is the proper way to :use clojure contrib so split resolves as a
> > > symbol?
> >
> > > ns test-csv
> > > (:gen-class)
> > > (:import (java.io BufferedReader FileReader StringReader))
> > > (:use clojure-csv.core)
> > > (:use [clojure.contrib.def]))
> >
> > > (defn process-file [file-name]
> > > (with-open [br (BufferedReader. (FileReader. file-name))]
> > > (println (split "," (line-seq br)))))
> >
> > > (defn -main [& args]
> > > (process-file "resultset.csv"))
> >
> > > Thanks.
> > > cmn
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en