diff options
author | Jason Katz-Brown <jason@airbnb.com> | 2013-08-25 02:17:13 -0700 |
---|---|---|
committer | Jason Katz-Brown <jason@airbnb.com> | 2013-08-25 02:17:13 -0700 |
commit | 9306cb60c32082c5403931de0823a9fd5daa196c (patch) | |
tree | ca1b6eb695fdf3f0c2294e92416b272164bae642 /clojure/wordmonger/macros.clj | |
parent | 8fb2c681cecc01b46b0f4ba02d5cc177c4747b1c (diff) |
Initial git commit.
Diffstat (limited to 'clojure/wordmonger/macros.clj')
-rw-r--r-- | clojure/wordmonger/macros.clj | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clojure/wordmonger/macros.clj b/clojure/wordmonger/macros.clj new file mode 100644 index 0000000..e0b6556 --- /dev/null +++ b/clojure/wordmonger/macros.clj @@ -0,0 +1,25 @@ +(defmacro color [name] + (let [long-name# (str "SWT/COLOR_" (.toUpperCase name))] + `(.getSystemColor *display* ~(symbol long-name#)))) + +(defmacro nary-or [first & rest] + (if rest + `(bit-or ~first (nary-or ~@rest)) + first)) + +(defmacro unless [condition & body] + `(when (not ~condition) ~@body)) + +(defmacro async [body] + `(.asyncExec *display* (proxy [Runnable] [] + (run [] ~@body)))) + +(defmacro random [radix] + `(.nextInt (java.util.Random.) ~radix)) + +(defn downcase [string] + (.toLowerCase string)) + +(defn upcase [string] + (.toUpperCase string)) + |