Fork me on GitHub
#beginners
<
2017-02-16
>
sb08:02:11

I saw you have experience with New Relic integration, what is the best solution now, what do you advise for a Clojure beginner? Or similar solutions? (I don’t have java knowledge, I saw a few solution, just I want to get feedback about this topic)

jeffh-fp18:02:31

I'm trying to call merge-with like this (merge-with + ({:a 1 :b 1} {:a 1 :c 3})) but it doesn't like the list of maps...instead it just wants the maps directly as args. Surely there's a simple function I'm missing to make it look like (merge-with + {:a 1 :b 1} {:a 1 :c 3}) so it evaluates correctly.

byron-woodfork18:02:09

@jeffh-fp what's your end goal data structure look like?

jeffh-fp18:02:53

(merge-with + {:a 1 :b 1} {:a 1 :c 3})
=> {:a 2, :b 1, :c 3}

jeffh-fp18:02:29

(the two :a records are summed)

olessavluk18:02:22

@jeffh-fp you can use apply - https://clojuredocs.org/clojure.core/apply (apply merge-with + '({:a 1 :b 1} {:a 1 :c 3}))

jeffh-fp18:02:51

that looks like it will do the trick -- thanks