我一直在查看示例和文档;我不知道为什么我会得到
loop requires an even number of forms in binding vector
错误。
我相信问题在于循环和初始化使用指标。我只是无法弄清楚我做错了什么。
(def usage-vec-len 13)
(defn ret-usage-indicies
"Takes a billed water consumption amount, and returns a vector of the ranges."
[reading]
(let [usage-indicies [0 0 0 0 0 0 0 0 0 0 0 0 0] curr-idx (- usage-vec-len 1)]
(loop [curr-reading reading ui usage-indicies curr-idx]
.
.
.
(if (= remaining-reading 0)
ui
(recur remaining-reading (assoc ui curr-idx curr-reading) (dec curr-idx)))))))