Here are some of my common mistakes:

user=> (def data (ref {}))
#'user/data
user=> (dosync alter data assoc :a "a")
"a"
user=> (dosync (alter data assoc :a "a"))
{:a "a"}
;; leaving out the parenthesis on a dosync can be silent and fatal,
like a ninja


(if-let [a 1]
  (println a)
  a
  (inc c))
java.lang.IllegalArgumentException: if-let requires a vector for its
binding (NO_SOURCE_FILE:0)
;; rather cryptic errors from if-let when not quite right, like an
illusionist using misdirection to awe the audience


(javax.swing.UIManager/setLookAndFeel
  javax.swing.UIManager/getSystemLookAndFeelClassName)
java.lang.Exception: Unable to find static field:
getSystemLookAndFeelClassName in class javax.swing.UIManager
(NO_SOURCE_FILE:7)
;; this one drives me nuts, I forget to call the method
;; if you don't read carefully it looks like maybe I just typoed the
long method name so I spend about 10minutes checking javadocs, cutting
and pasting, importing etc
;; The error while correct seems a bit odd seeing Class/method looks a
method (though I understand why it isn't).

(java.lang.Math/abs 2/3)
java.lang.IllegalArgumentException: No matching method found: abs
(NO_SOURCE_FILE:0)
;; abs wont work on ratios, but the error message doesn't give the
signature being sought.
;; abs for java numbers exists, abs for ratios doesn't.
;; It is not always obvious that 2/3 is a ratio if it is a passed in
variable.


Regards,
Tim.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to