I have a problem in this function although it compiles without errors!
The function gets two vectors with the same length n, another vector with length 2^n, and an index. The function does a simple calculation and then returns a vector.
The problem appears when trying to call the function. For example:
(check [1 2 3] [1 2 3] [1 2 3 4 5 6 7 8] 1)
java.lang.IllegalArgumentException: Key must be integer (NO_SOURCE_FILE:0)
Function definition:
(defn check [row1 row2 arr j]
(
(def x1 (nth arr (nth row1 j)))
(def x2 (nth arr (nth row2 (- j 1))))
(def x3 (nth arr (nth row1 (- j 1))))
(if (<= x1 x2)
(
(def row1 (assoc row1 j x3))
row1
)
((def row1 (assoc row1 (- j 1) x2))
row1)
)
)
)
I cleaned up your code to this:
I have no idea if that does what you want it to do, but the function evaluates, and returns sensible values, e.g.