You can use the doc function to find out what json-str does:

(doc json-str)
-------------------------
clojure.contrib.json.write/json-str
([x])
  Converts x to a JSON-formatted string.
nil

json-str is a function of its arguments, and it does not do anthing 
side-effecty like capturing stdout.

Putting something with side effects ('do' or 'print') inside a lazy expression 
like 'for' is a bad idea in most cases. The side effects will happen later (if 
ever) when the lazy sequence is consumed.

What are you trying to do?

Stu

> Macintosh:clojurefun wojtek$ ./runfile.sh
> Clojure 1.1.0
> user=> (use 'clojure.contrib.json.write)
> nil
> user=> (json-str (for [a [1 2 3]] (do (print "a") "b")))
> "[aaa\"b\",\"b\",\"b\"]"
> 
> 
> I think json-str shouldn't capture the printed a's, should it?
> 
> -- 
> 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

Reply via email to