deft/notes/2020-05-26--06-21-28Z--idiomatic_clojure_mixing_side_effects_and_iteration.org

16 lines
471 B
Org Mode
Raw Permalink Normal View History

2021-09-15 07:12:29 +00:00
:PROPERTIES:
:ID: 0ffa6c7e-87c3-4cbc-8896-7208462f9268
:END:
2020-05-26 07:38:56 +00:00
#+TITLE: Idiomatic Clojure: Mixing Side Effects and Iteration
#+Author: Yann Esposito
2021-09-15 07:12:29 +00:00
tags :: [[id:debfbdb6-03a6-478e-8316-bce0119c0dd7][clojure]]
2020-05-26 07:45:32 +00:00
source :: [[https://bsless.github.io/side-effects/][Idiomatic Clojure: Mixing Side Effects and Iteration]]
2020-05-26 07:38:56 +00:00
Main lessons:
- Never use ~doall~
- use ~mapv~ or ~(into [] (map f) coll)~ if you want to retrieve the elements
- use ~(run! f coll)~ or ~doseq~