Skip to content

Instantly share code, notes, and snippets.

@lagenorhynque
Created October 6, 2017 08:43
Show Gist options
  • Select an option

  • Save lagenorhynque/4bdff687d29731c2eeecacff257783fb to your computer and use it in GitHub Desktop.

Select an option

Save lagenorhynque/4bdff687d29731c2eeecacff257783fb to your computer and use it in GitHub Desktop.
;; cf. https://github.com/ctford/traversy
user> (require '[traversy.lens :as lens])
nil
user> (def data {:a [{:aa 1 :bb 2}
{:cc 3}]
:b [{:dd 4}]})
#'user/data
user> (-> data
(lens/update (lens/*> lens/all-values lens/each lens/all-values)
#(if (even? %) (inc %) %)))
{:a [{:aa 1, :bb 3} {:cc 3}], :b [{:dd 5}]}
user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment