I made a stupid mistake, and I want to share. This is not the actual code, I
simplify it to demonstrate the point.
I use a atom to a global hash as follow:
(def *aa* (atom {:x 3 :y 4 :z 17}))
Somewhere on the code, I have a function which look at the state and do
something:
(defn foo [state]
(when (:x state) print "yes"))
My mistake - call foo as:
(foo *aa*)
where I should have call it
(foo @*aa*)
Since (:x (atom *aa*)) is nil, print was not execute.
4 long hours later, I got it, fix it, and added the appropriate
precondition.
I understand there is no escape from my own silliness, but could I have
avoided this mistake to begin with?
Any best practice I broke?
Thanks
Tzach
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en