>
> Hey Timothy, I just finished working through the code from your talk and 
> have a question. In the code there is this code:


(go (loop []
>       (when-let [v (<! print-chan)]
>         (println v)
>         (recur)))) 

 


I wanted to expand it into something like a logger that writes out to a 
file though, so I made the relevant test.txt file, stuck it in resources 
and  changed the code to look like this: 

(use 'clojure.java.io)
> (use 'clojure.core.async)
>
 

> (def print-chan (chan))
>
 

> (go (loop []
>       (when-let [v (<! print-chan)]
>         (with-open [wrtr (writer "resources/test.txt" :append true)]

          (.write wrtr v))
>         (recur)))) 
>
> (>!! print-chan 42)


But when I do this, I find that it will only replace what is in the file, 
and not append to it. Sometimes also, the output that ends up in the file 
is a little odd, too. I tried to put 42 and I got * instead. When I use the 
writer without the  core.async functions, it works as expected. I am using 
light table. 

Jesse

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to