In the documentation for Clojure special forms (http://clojure.org/special_forms) the example for :pre
and :post
looks like this:
(defn constrained-sqr [x]
{:pre [(pos? x)]
:post [(> % 16), (< % 225)]}
(* x x))
How can Clojure tell if the map containing the meta-data is not the definition of the function? Shouldn't the meta-data precede the params vector? According to the documentation for defn
(http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/defn), the syntax is
(defn name doc-string? attr-map? [params*] body)
with the attr-map?
before the params vector. Isn't this more correct:
(defn constrained-sqr
{:pre [(pos? x)]
:post [(> % 16), (< % 225)]}
[x]
(* x x))
Should I file a bug report or am I misreading this?
Sorry to pick nits.