Just as a note, you should probably use `doseq` when you want to produce side effects.
Erik. > On 7 Feb 2019, at 12:04, Pierpaolo Tofani <pierpaolo.tof...@gmail.com> wrote: > > Hi > i am new in clojure sorry. > In the snippet of code i used two map functions only to produce side effects > on two ref. > Even using doall no affect is produced on ref aaa and zzz, seems that the > sequence is still lazy. > But if i remove the final :done , and the repl show me the sequence produced > (that i don't care) the ref aaa and zzz are affected.Thanks in advance. > PS The two map are in effect doing a for. > > (def aaa (ref 0)) > (def zzz (ref 0)) > (def s1 [1 2 3 4 5]) > (def s2 [1 2 3 4 5]) > (defn make-side [] > (do > (doall > (map > (fn [x] > (map > (fn [y] > (dosync > (alter aaa inc) > (alter zzz dec) > ) > ) > s2)) > s1) > ) > :done > ) > ) > > > -- > 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 > <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 > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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/d/optout.