On Mar 20, 2010, at 13:05 , WoodHacker wrote: > When I run the following: > > (for [y (range 4)] (for [x (range 4)] (println x y))) > > I get what I expect - 0 0, 1 0, 2 0, 3 0 etc., but at the end of > each y loop I also get 4 nils. > > ((0 0 > 1 0 > 2 0 > 3 0 > nil nil nil nil) (0 1 > 1 1 > 2 1 > 3 1 > nil nil nil nil) (0 2 > > What's going on? And how do I fix it? Adding a :when to test for > nil does not seem to do anything. what you see is (and I pull it apart here) STDOUT: 0 0 1 0 2 0 3 0 0 1 1 1 2 1 3 1
on the repl output (return value of your expression you see: ((nil nil nil nil) (nil nil nil nil)) which is because the return value of println. Best regards, Heinz -- 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 To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.