Thanks Stefan. I had a suspicion that it was to do with for's laziness but I had assumed it was a characteristic of the seq it built rather than the forms inside it. Seems a bit strange but will have to get used to it :-)
On Monday, November 25, 2013 2:11:45 PM UTC, Stefan Kamphausen wrote: > > Hi Edward, > > > you are being hit by laziness here. Clojure's 'for' is not like the 'for' > you may know from other programming languages. It is made for list > comprehensions, that is it is building new list-y things. It does not do > this instantly, the items may be realized only when the caller asks for > them. In your case the caller is your REPL which prints the return value, > thereby realizing the lazy sequence. Thus, the output for the REPL and > your println mix. > > As Cedric already wrote, if you want to process the board for side-effect > like printing, use doseq. Use for only for its return value and make no > assumptions as to when those values are created. > > > Kind regards, > Stefan > -- -- 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/groups/opt_out.