On Jun 1, 2009, at 4:55 AM, Emeka wrote: > This gives you the link to the whole code. > http://friendpaste.com/C3xbF1r3F3Mehnn8CCBUm > . It is still not cleaned..pretty ugly, I am ashamed to show it > off at all :)
Thanks, and you should be! :) Of course the only way to get better is to try and get feedback, so we'll postpone the burning at the stake to a later date. I agree with Tim. Let's look at proceed-now-right: (defn proceed-now-right [alon key] (let [val (extract-num alon key) ;; expression 1 is here row-dev (eval (get-next-row inc (first val))) keyword-dev-right (get-key inc (second val)) cell-empty-right (check-cell-empty? keyword-dev-right row-dev)] (if cell-empty-right (do (chang row-dev keyword-dev-right (@alon key)) (chang alon key \space)) ;; expression 2 is here (println "can't do this")))) The first expression I marked seems to be treating alon as a regular value: (let [val (extract-num alon key) ...) because extract-num just does this: (defn extract-num [sand key] (let [n (Integer/parseInt (re-find #"\d+$" (name sand))) m (Integer/parseInt (re-find #"\d+$" (name key)))] [n m])) So alon must be a symbol or a keyword in the let at the beginning of proceed-now-right, because 'name' only works on those two types. But then you have this expression in the do (second place I marked in the code above): (@alon key). You can't dereference a symbol (it's not a ref), so either alon is a ref to something or it's a symbol, but either way you have a bug in proceed-now-right. I don't see anything calling proceed-now-right in your code, which is what we would have needed to determine exactly what the problem is. In other words, I'm not sure if expression 1 or expression 2 is wrong (or both). I think your code will get a lot simpler if you find a more appropriate data structure, such as a two-dimensional array. I find that cleaner code is also easier to debug, so if I were you I might start over rather than try to make this work. Hope that helps, — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---