On Sep 13, 2011, at 2:39 AM, jingguo wrote:

> I get a_message printed twice if I paste the code in a clojure REPL.
> But I save the code into a file called foo.clj and use "clj foo.clj"
> to run it. I get nothing in stdout. It seems that (printf "a_message
> \n")
> is not evaluated. Can anybody explain this behavior? Thanks.

`for' yields a lazy sequence, whose elements are not actually evaluated until 
they are used. The REPL automatically prints the result of each expression you 
evaluate, which is the only thing that's causing those printfs to get 
evaluated. Try using `doseq' instead.

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