From 9306cb60c32082c5403931de0823a9fd5daa196c Mon Sep 17 00:00:00 2001 From: Jason Katz-Brown Date: Sun, 25 Aug 2013 02:17:13 -0700 Subject: Initial git commit. --- clojure/wordmonger/macros.clj | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 clojure/wordmonger/macros.clj (limited to 'clojure/wordmonger/macros.clj') 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)) + -- cgit v1.2.3