Re: Using map to produce side effects, not working

2019-02-08 Thread Alan Thompson
Also remember that `mapv` is not lazy and will force the map to run right away, which helps if side-effecty things like `println` are a part of the function. On Thu, Feb 7, 2019 at 10:54 AM Justin Smith wrote: > also do note that clojure.core/run! is designed for two-arg map when > it's only

Re: Using map to produce side effects, not working

2019-02-07 Thread Justin Smith
also do note that clojure.core/run! is designed for two-arg map when it's only run for side effects, and clojure.core/doseq is designed for nested side-effecting iteration On Thu, Feb 7, 2019 at 3:33 AM Pierpaolo Tofani wrote: > > Thanks ! Your diagnosis is correct. With two dorun works fine. >

Re: Using map to produce side effects, not working

2019-02-07 Thread Erik Assum
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 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

Re: Using map to produce side effects, not working

2019-02-07 Thread Pierpaolo Tofani
Thanks ! Your diagnosis is correct. With two dorun works fine. Il giorno giovedì 7 febbraio 2019 12:19:40 UTC+1, Orestis Markou ha scritto: > > Without having ran your code, it seems that the inner map is not wrapped > in a doall, so while the outer lazy-seq is forced, the inner is not. > > This

Re: Using map to produce side effects, not working

2019-02-07 Thread Orestis Markou
Without having ran your code, it seems that the inner map is not wrapped in a doall, so while the outer lazy-seq is forced, the inner is not. This might be of interest to you: http://clojure-doc.org/articles/language/laziness.html If

Using map to produce side effects, not working

2019-02-07 Thread Pierpaolo Tofani
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