On Mon, May 31, 2010 at 14:11, 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))))))
Your (recur ...) is completely mixed up. The specific error you are seeing is because of the subexpression: (cont (contains? ...)) which attempts to apply cont as a function to the result of the call to (contains? ...). cont isn't a function, it's a boolean value (you gave it the value false at the start of the loop). > The call=> (valueIn(sudoku vall poss) gives me the above error. > > Thank you, > -- Gary > > -- > 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 -- 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