【发布时间】:2019-07-21 01:31:16
【问题描述】:
我不知道如何表达,但问题是:
(defmacro defbasic [val-fn]
(let [;; Like str but keywords are str'd without :
fn-name (fdat/->string "make-" val-fn)
;; This is a hashmap got from basic-builders
;; which is def
options (get basic-builders val-fn)]
`(defn ~fn-name
([]
(~fn-name {}))
([descriptor]
(->basic-operation ~options descriptor)))))
函数 ->basic-operation 有效并且之前定义过。宏的目的是创建通用强制器,例如:
(defbasic :cat) ;; ==> defn a make-cat function
我看到了 clojure 规范,但我看不出问题出在哪里。我看到了地图和正确的数据。
我认为问题可能在于存在一个 arities 列表这一事实?
谢谢
【问题讨论】: