You can put the line break back into each line (" added stuff\n") and
then do:
(spit "output.txt" (reduce str (map change-line old-data)))

On Aug 16, 8:26 am, Thomas <th.vanderv...@gmail.com> wrote:
> Hi everyone,
>
> I have been struggling with this, hopefully, simple problem now for
> quite sometime, What I want to do is:
>
> *) read a file line by line
> *) modify each line
> *) write it back to a different file
>
> This is a bit of sample code that reproduces the problem:
>
> ==========================================================
> (def old-data (line-seq (reader "input.txt")))
>
> (defn change-line
>     [i]
>     (str i " added stuff"))
>
> (spit "output.txt" (map change-line old-data))
> ==========================================================
> #cat "output.txt"
> clojure.lang.LazySeq@58d844f8
>
> Because I get the lazy sequence I think I have to force the execution?
> but where
> exactly? And how?
>
> Thanks in advance!!!
>
> Thomas

-- 
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

Reply via email to