Hi,
I'm trying to write a function which creates file twice as big
compared to the original file by simply duplicating its content.
It looks like in the for loop I can't even read the first line
although I'm using with-open. Can you tell me what am I doing wrong?
(defn duplicate-file-data [file-path]
(with-open [reader (clojure.java.io/reader file-path)
writer (clojure.java.io/writer (str file-path 2) :append
true)]
(for [line (line-seq reader)
:let [line-count (count(line-seq
reader))
curr-line 0]
:when (< curr-line line-count)]
((.write writer (str line))
(.newLine writer)
(inc curr-line))
)))
--
Thanks
Daniel
--
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