always mapv when doing I/O on the backend and always extra vec when returning sequences in the frontend
Re:Clojure Don’ts: Lazy Effects (2015)
by joncampbelldev on Saturday March 03, 2018 @05:52PM
(#16512182)
run! and doseq are for IO on each element of a sequence. Functions like mapv are intended for data transformation, not side-effects. This is why run! and doseq return nil
It's often not clear what is lazy and what isn't - concat is lazy for instance. It isn't externally obvious which of the very common operations are lazy, filter being lazy has bitten me in CLJS a few times too.
Adding to the source of the confusion is that the REPL will often realize your side-effects which then won't get evaluated in your runtime environment.
One of the errors I used to make earlier on was: