Prefix, simply because operator precedence is explicit.
FYI, Longer calculations (really, any chain of operations) in Clojure can be broken out using the ->
and ->>
macros. e.g.:
(-> (get-some-value)
inc
(* 2)
(max 50))
is the equivalent of:
(max (* (inc (get-some-value)) 2) 50)
While the ->
macro prepends prior results to the arguments of the next expression, ->>
appends them. This is typically very handy when used with functions that expect collections and seqs:
=> (->> "some string we want to capitalize"
(partition-by #{\space})
(mapcat #(cons (Character/toUpperCase (first %)) (rest %)))
(apply str))
"Some String We Want To Capitalize"
Providing facilities for easily composing simpler operations into compound ones like this is one of Clojure's big advantages. For additional reading, check out fogus' post on the ->
macro, and then his later post on the topic of "properly thrushy" thrush combinators in Clojure.