Clojure — partial in `->` macro
clojure
Solution
needs an extra set of parens:
user> (-> 5 - ((partial + 5)))
0
the `->` macro inserts the result of the previous expression as the second argument in the list so in your example it would exand to `(partial (- 5) + 5)` with the extra () it gets inserted after the partial function `((partial + 5) (- 5))`
Problem
I've just started using Clojure, and I was wondering why the following doesn't work as expected: ``` (-> 5 - (partial + 5)) ``` I would expect the result of this expression to be 0 (-5 + 5), but instead the whole thing seems to be a partial. ``` (macroexpand `(-> 5 - (partial + 5)) #_=> ) (clojure.core/partial (clojure.core/-> 5 clojure.core/-) clojure.core/+ 5) ``` Why is this, and how can I do what I wanted to?