In my Clojure code I'd like to to use a side-effecting method of Java object in a loop. My intention is to set multiple parameters of the Java object to values that I store in a map:
(def params {
:param1 "value1"
:param2 "value2"
})
If I set param1 to "value1" directly, it works fine:
(.setParam object (str :param1) "value1")
However, if I want to iterate over the params map forcing the evaluation by using doseq, the Java object remains untouched:
(doseq [[param value] params] (.setParam object (str param) value))
How to loop over the params map and use the side-effecting setParam method so that the Java object is mutated?
I believe this is likely a beginner error that would be easy to resolve for more experienced Clojure users.