I have an atom like this, inside a let:
(let [scors (atom {:one {:year-one [] :year-five [] :year-ten []}
:two {:year-one [] :year-five [] :year-ten []}
:three {:year-one [] :year-five [] :year-ten []})]
some code...
)
Inside a for loop, I want to swap this atom to add data depends on the if statements inside that loop.
For example I tried this, but it didn't work:
(swap! scors :assoc {:one :year-one} (:set-of-inputs each)))
So for example I want to add {:name "someone"}
to :one :year-one
. How can I update the :year-one
?
Thank you in advance.
Use swap! with update-in
(swap! scors update-in [:one :year-one] conj (:set-of-inputs each))