Re: Sorry Don't understand for macro, a bug or a newbie-question??

2012-01-20 Thread aschoerk
Ah,
thank you,  so a newbie question.
But helped me a lot.

Andreas

On Jan 18, 10:26 pm, Jack Moffitt j...@metajack.im wrote:
  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 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


Re: Sorry Don't understand for macro, a bug or a newbie-question??

2012-01-18 Thread Jack Moffitt
 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 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


Re: Sorry Don't understand for macro, a bug or a newbie-question??

2012-01-18 Thread dennis zhuang
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 j...@metajack.im

  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 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




-- 
庄晓丹
Email:killme2...@gmail.com
伯岩(花名)  bo...@taobao.com
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 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