for returns a lazy sequence.You may prefer doseq:
(defn fortest2 []
(doseq [a (range 2 10)
b (range 2 10)]
(do
(println "x: " a " b:" b)
(list a b)))
(println "ende")
)
(fortest2)
doseq will be forced for side-effects.
2012/1/19 Jack Moffitt <[email protected]>
> > doesn't show any effect of the for.
> > The only difference is the additional statement at the end.
> > I can not imagine how this statement sequentially behind can influence
> > the for.
>
> for returns a lazy sequence. In the first case, in printing out the
> result to the REPL, the lazy sequence is realized, and in the second,
> the result is discarded so it is never realized.
>
> jack.
>
> --
> 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
>
--
庄晓丹
Email: [email protected]
伯岩(花名) [email protected]
Site: http://fnil.net
淘宝(中国)软件有限公司 / 产品技术部 / Java中间件
--
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