`into` with more three arguments is a variant where the middle argument is
a transducer. So your original code was trying to use default-config as a
transducer, this code would work with either merge or into chained with ->:
(-> {} (into default-config) (into more-config))
I recently did a tutorial video on into you may also find interesting:
https://www.youtube.com/watch?v=5_eRZRIuqiY
Timothy Baldridge
On Sat, Dec 17, 2016 at 11:22 AM, larry google groups <
[email protected]> wrote:
> I was trying to combine 2 maps into a new map, as you can see here. I
> printed both maps to the screen so I could see that, indeed, they were both
> maps. And yet I got a NullPointerException on the last line here:
>
> (defn update-config
> [more-config]
> (swap! config-holder
> (fn [old-config]
> (let [default-config (if old-config old-config {})]
> (println "default-config ")
> (clojure.pprint/pprint default-config)
>
> (println "more-config")
> (clojure.pprint/pprint more-config)
> (into {} default-config more-config)))))
>
>
> I took the last line and changed it so I only had the second map merging
> with the first map:
>
> (into default-config more-config)
>
> This seems to fix the problem.
>
> Perhaps I have "into" and "merge" confused. What was I doing wrong?
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.