Hi, On Oct 7, 10:50 am, Hans Sjunnesson <hans.sjunnes...@gmail.com> wrote:
> However when I want to do more things in the doseq body, or I simply > add an extra set of parentheses around the println statement, I get a > nullpointer. > (doseq [x (xml-seq foo)] ((println x))) Just do multiple things in the doseq body: (doseq [x (xml-seq foo)] (println x) (do-more stuff) (and-more-and-more)) The NPE is actually not strange, but to be expected. (println x) returns nil (which corresponds to Java null). So ((println x)) tries to call the result of (println x) as a function. But since the result is nil you get the NPE. In Clojure parentheses are not some grouping construct, but they denote always a function (or macro) call. To group several expressions together use do: (do (a) (b) (c)) (which is again a "call" to the do special form). doseq does an implicit do, so you don't have to do it. Hope this helps. Sincerely Meikel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---