Ambiguity in the Clojure attribute table

The documentation for Clojure special forms ( http://clojure.org/special_forms example for :preand :postlooks like this:

(defn constrained-sqr [x]
    {:pre  [(pos? x)]
     :post [(> % 16), (< % 225)]}
    (* x x))

How can Clojure indicate if a map containing metadata is not a function definition? Should metadata precede params vector? According to the documentation for defn( http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/defn ), the syntax

(defn name doc-string? attr-map? [params*] body)

c attr-map? to vector of parameters. Is this wrong:

(defn constrained-sqr
    {:pre  [(pos? x)]
     :post [(> % 16), (< % 225)]}
    [x]
    (* x x))

Should I write a bug report or am I misunderstood this?

Sorry to choose nits.

+3
source share
1 answer
+5

Source: https://habr.com/ru/post/1770904/


All Articles