我一直有这个错误,但我似乎无法解决它。
(ns stack)
(def output [[1, 2 ,3]])
(def condensedrecords 0)
(def i 0)
(def currentDateTime 0)
(def timeDiffinSeconds 0)
(def secondLastOutputValue 0)
(def outlier [])
(def isOutlier false)
(def timeDiffinSeconds 20)
(def for1 true)
(def ab [1])
;just for testing
(def a [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])
(def b [a, a])
(def NoOfLines 3)
(defn getOutlierConfidence [p i]
0.5)
(defn processNewTransaction [p i] 1)
(defn exceedTimeThresholdwDistance [p i] false)
(defn doRunThroughSplit [vector]
(loop [i 1
condensed 0
output1 output
outlier1 outlier]
(if (< i (- NoOfLines 1))
(let [p ((peek output1) 1)] ;function doesnt work
(cond
;cond1
(= ((vector i) 27) ((peek output1) 1)) (do(let [condensed (inc condensed)]
(println "in cond1")
(recur (inc i) condensed output1 outlier1)))
;cond2
(> timeDiffinSeconds 480) (do (let [i (processNewTransaction p i)] (println "in cond2") (recur (inc i) condensed output1 outlier1)))
;cond3
(> timeDiffinSeconds 600) (do (let [i (processNewTransaction p i)] (println "in cond3") (recur (inc i) condensed output1 outlier1)))
;cond4
(exceedTimeThresholdwDistance p i) (do (let [i (processNewTransaction p i)] (println "in cond4") (recur (inc i) condensed output1 outlier1)))
(and (not= ((peek output) 1) ((vector i) 27)) (not= secondLastOutputValue ((vector i) 27)))
(do ;perform the following statements
(println "in cond5")
(let [secondLastOutputValue ((peek vector) 27)]
***output1 (conj ([output1] ab))]*** ;error starts at here/// ab is a vector by commenting this line the error is removed
(println "reached")
(recur (inc i) condensed output1 outlier1)))
);cond ending
);let ending
[condensed, output1, outlier1]);if ending
);loop ending
);func ending
(def sa (doRunThroughSplit b))
该错误已被注释掉,即行 output1 (conj ([output1] ab)) 但我似乎根本无法解决此错误。大部分代码看起来都很好,但是一旦在 cond5 中遇到 let 语句,就会出错。
输出将是
在 cond5 ///这里结束