2
(defn matrix-diagonals-odd-p
  ([matrix] (matrix-diagonals-odd-p matrix 0))
  ([matrix offset]
     (let [len (alength matrix)]
       (if (> (+ (bit-shift-right len 1) (bit-and len 1)) offset)
         (if (= (+ (bit-and (get (get matrix offset) offset) 1)
                   (bit-and (get (get matrix (- len 1 offset)) (- len 1 offset)) 1)
                   (bit-and (get (get matrix offset) (- len 1 offset)) 1)
                   (bit-and (get (get matrix (- len 1 offset)) offset) 1)) 4)
         (recur matrix (inc offset))
         false) true))))

我得到java.lang.UnsupportedOperationException: Can only recur from tail position但这尾部位置。为什么/什么给了?

4

1 回答 1

1

这适用于 Clojure 1.3 和 1.4。也许同一个命名空间中还有其他功能会造成麻烦?

于 2012-05-09T21:59:59.800 回答