4
我正試圖在我正在寫的clojure程序中實現一個記錄協議。我得到的錯誤是「不支持的綁定表單」。爲什麼在clojure中實現協議時會出現「Unsupported binding form」錯誤?
(defprotocol query-rows
(query-text [table])
(trans-cols [table rows])
(set-max [table] [table id]))
(defrecord Submissions [data max-id]
query-rows
(query-text [table]
(gen-query-text "SubmissionId" "Valid" "Submission"))
(trans-cols [table rows]
(let
[trans-data
(->>
rows
(trans-col #(if % 1 0) :valid :valid_count)
(trans-col #(if % 0 1) :valid :non_valid_count)
(trans-col format-sql-date :createdon :date))]
(assoc table :data trans-data)))
(set-max
([table]
(when-let [id (gen-get-max "SubmissionAgg2")]
(assoc table :max-id id)))
([table id] (assoc table :max-id id))))
「set-max」函數是拋出錯誤的東西。我有一種感覺,我試圖錯誤地使用多個參數。有誰知道我做錯了什麼?
太棒了,謝謝。 –