How do you define side-effects?

-sun


On Jan 24, 5:26 am, Christophe Grand <[email protected]> wrote:
> Tzach a écrit :
>
> > The text on the panel do update.
> > When I try to do the same for all the elements:
> >  (for [t (components r)]
> >    (.setText t (str 6)))
>
> > Nothing happened.
> > What am I missing here?
>
> 'for should not used for side effects because it is lazy. (To force it
> to perform the computations (and thus the effects), you have to wrap it
> in a 'dorun.)
>
> Use 'doseq instead:
>
> (doseq [t (components r)]
>         (.setText t (str 6)))
>
> ('doseq starts with "do": it is meant for side-effects)
>
> Christophe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to