2

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.

Charles
  • 50,943
  • 13
  • 104
  • 142
interstar
  • 26,048
  • 36
  • 112
  • 180

1 Answers1

3

Easiest is just to write an anonymous function:

(defn everything [extra]
  (comp #(conj % {:data extra}) another-func))
Charles Duffy
  • 280,126
  • 43
  • 390
  • 441