kibit
kibit copied to clipboard
Bad advice on (loop [] (when ... (recur)))
trafficstars
The following code
(loop []
(when (> 2 1)
(println "Continuing...")
(Thread/sleep 300)
(recur)))
generates the following Kibit warning:
At /Users/jjacobsen/.../breakkibit/src/breakkibit/core.clj:4:
Consider using:
(while (> 2 1) (println "Continuing...") (Thread/sleep 300) (recur))
instead of:
(loop []
(when (> 2 1) (println "Continuing...") (Thread/sleep 300) (recur)))
The proposed (recur) isn't needed and in fact won't compile.
Thanks for reporting this, I'll take a look ASAP. Thanks!