문제

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