Thanks Armando for catching my stupid mistake. That fixed everything.

Meikel, I'm not sure I understand what you're saying. When I evaluate
this in the REPL

(for [x (range 2) y (range 2)] (aset xt x y (+ x y)))
(aget xt 0 0)
(aget xt 1 1)

I get back 0 and 2 as I expect. Isn't the call to aset consuming the
lazy sequence?

Thanks.

On Sep 13, 11:00 am, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On 13 Sep., 15:07, Ranjit Chacko <rjcha...@gmail.com> wrote:
>
> >     (for [x (range 3) y (range 3)] (aset xt x y 1))
>
> Note that that this will not do what you think it does. for creates a
> lazy sequence which is thrown away immediately. So the aset calls are
> never done. for is a list comprehension, not a looping construct.
> Replace for with doseq. As a rule of thumb: side-effects => command
> starting in "do".
>
> 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

Reply via email to