Re: Map vs Doseq on agents

2012-12-27 Thread Marko Topolnik
Clojure's *map* is agnostic to whether the mapping function has side effects. The only thing to keep in mind is that *map* is not imperative, but declarative: it gives you a lazy sequence whose elements will be the results of the mapping function. As soon as you realize the sequence, for exampl

Re: Map vs Doseq on agents

2012-12-27 Thread Baishampayan Ghose
Because unlike in CL, `map` in Clojure produces a lazy (and possibly infinite) sequence. If the mapping function is impure then laziness makes things harder to reason about. If you want `map` like behaviour but don't want laziness, you can check out `mapv` which returns a vector instead of a lazy