I'm trying to create a function that applies several processes to a map, including adding / updating some standard items to each map using "conj". I'm doing it by composing several other functions using "comp".

So I tried doing this

(defn everything [extra] (comp (partial conj {:data extra}) another-func) )

Which won't work because conj wants the extra data as the second argument, not the first.

I assume there should be a similarly straightforward way of composing a curried conj, but I can't quite figure out how to do it.

有帮助吗?

解决方案

Easiest is just to write an anonymous function:

(defn everything [extra]
  (comp #(conj % {:data extra}) another-func))
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top