Clojure “宏总是抛出”;不匹配限制器“;如果给定一个n函数

Clojure “宏总是抛出”;不匹配限制器“;如果给定一个n函数,clojure,clojurescript,Clojure,Clojurescript,我编写了一个宏来处理http响应 (defmacro defhandler [name & args] (let [[docstring args] (if (string? (first args)) [(first args) (next args)] [nil args]) args (apply hash-map :execute-if true (

我编写了一个宏来处理http响应

(defmacro defhandler
  [name & args]
  (let [[docstring args] (if (string? (first args))
                           [(first args) (next args)]
                           [nil args])
        args (apply hash-map :execute-if true (vec args))]
    `(do
       (def ~name
         (with-meta (fn [scope# promise#]
                      (let [e# (:execute-if ~args)
                            ei# (if (fn? e#)
                                  (e# scope#)
                                  (boolean e#))]
                        (when ei#
                          (.then promise# (fn [result#]
                                            (let [{:strs [http-status# value#]} result#
                                                  the-func# ((keyword http-status#) ~args)]
                                              (the-func# scope# value#))))))) {:structure ~args}))
       (alter-meta! (var ~name) assoc :doc ~docstring))))
所以我能做到

(defhandler my-handler
  :200 (fn [$scope value] (set! (.-content $scope) value)))
但这会在第1行抛出“UnmatchedDelimiter”,但如果我尝试使用命名函数:

(defn my-func [$scope value] (set! (.-content $scope) value))

(defhandler my-handler 
  :200 my-func)

它工作正常。我只是好奇,这是正常的行为吗?

这不是我在尝试你的例子时看到的行为,看起来也不太可能。我建议检查您粘贴在此处的表单是否正是产生错误的表单;我怀疑您实际的匿名函数包含了太多的
s.

您看到的行为是什么?这很奇怪。我还尝试复制此页面上的代码,但仍然给出错误。无论如何,谢谢你的回复。