On May 31, 2:11 pm, garyk <gkhomin...@gmail.com> wrote: > Hi, > I've started learn Clojure. While I am writing some functions I was > getting the java.lang.Boolean cannot be cast to clojure.lang.IFn. I > was wondering if somebody could help me to move on: > > ; for testing > (def sudoku ( sorted-map '[1 1] '(98) '[1 2] '(123) '[2 1] '(56789) > '[2 2] '(456))) > (def vall 4) > (def poss (vector [1 1] [1 2])) > > (defn valueIn [map value positions] > (loop [start (first positions) end (rest positions) cont false] > (if (or (true? cont) (nil? start)) > cont > (recur (cont (contains? (get map start) value)) (start (first > end)) (end (rest end))))))
recur takes positional arguments, not (key value) "pairs" (which aren't pairs, but function calls). You want *something* like (recur (first end) (rest end) (contains? (get map start) value)) but I can't really make heads or tails out of your code. Note that '(56789) is a list of ONE number, while it looks like you're expecting it to be a list of digits - that would be '(5 6 7 8 9) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en