recur应该在尾部位置调用,我假设它有效地充当了非递归的准循环。
在下面的模拟块结构中,是否将[[expr-1或2视为正确的尾巴位置,但没有<< [expr-3至8?否则,在求助于错误之前如何推理和识别它?
(defn foo [x]
(if cond-expr-1
(recur expr-1)
(recur expr-2)))
(defn bar [x]
(if cond-expr-2
(fn-1 (recur expr-3))
(fn-2 (recur expr-4))))
(defn baz [x]
(if cond-expr-3
(if cond-expr-4
(recur expr-5)
(recur expr-6))
(if cond-expr-5
(recur expr-7)
(recur expr-8))))
recur
基本上就像goto
或return
语句,它们都不能在函数参数列表中使用。