Reputation: 3203
Is there a function in clojure that takes two or more arguments and supplies them to a function, so f(f(f(a, b), c), d) etc.
I know I can do something like this:
(fn g [& items] (reduce f (seq items)))
But is there a better way to do it?
Upvotes: 3
Views: 100
Reputation: 11726
That's exactly how you should do it. In fact removing seq
would make it even simpler without changing the behaviour.
Upvotes: 4