3
當長度爲4時,循環執行5次。從流中讀取5個字符。Clojure循環讀取一個額外的
(loop [i (.read stream) result "" counter length]
(let [c (char i)]
(println "=>" c)
(if (zero? counter)
result
(recur (.read stream) (str result c) (dec counter)))))
所以我應該在循環之前增加一個測試爲零,但我仍然不知道爲什麼它正在運行的5倍?這是clojure的行爲還是我錯過了什麼? – 2009-06-28 22:24:41