morning folks
I’m working through exercise 2 on this site: http://www.braveclojure.com/functional-programming/#Exercises
I have
(defn my-comp
"Exercise 2: Implementing comp"
[f & fs]
(if (nil? fs)
(fn [& args] (apply f args))
(fn [& args] (f (apply (apply my-comp fs) args)))
)
)
it works
but the (f (apply (apply my-comp fs) args))
form seems clunky
any thoughts?
if you make the base case for two functions instead of one you can use reduce
Nice