Clojure nested map - change value

前端 未结 2 712
说谎
说谎 2021-01-01 18:06

have to say I started learning Clojure about two weeks ago and now I\'m stuck on a problem since three full days.

I got a map like this:

{
  :agent1          


        
2条回答
  •  生来不讨喜
    2021-01-01 18:53

    The walking functions are good for replacement like that.

    (clojure.walk/prewalk-replace {[:team "X"] [:team "H"]} map)

    Passing in vectors allows you to ensure that you don't just replace all the "X"s.

提交回复
热议问题