   (try
     (do (eval form) true)
     (catch Throwable _ false)))
+
+(defn attempt-eval
+  [form default]
+  (try
+    (eval form)
+    (catch Throwable _ default)))
+
+(defmacro attempt-defn [& body]
+  `(attempt-eval
+     '(defn ~@body)
+     (def ~(first body) (constantly nil))))
 
 (def new-mac-full-screen
   (can-eval? '(do (import com.apple.eawt.FullScreenUtilities)


(def old-bounds (atom {}))

(def mac-new-toggle-full-screen
  (attempt-eval
    '(fn [window]
       (.requestToggleFullScreen
         (eval `(Application/getApplication)) window))
    (constantly nil)))

(defn full-screen!
  "Make the given window/frame full-screen."

         (windowExitingFullScreen [_])
         (windowExitedFullScreen [_]
           (swap! fullscreen-windows disj window)))))

(defn setup-fullscreen
  "Endows the given window with the ability to enter and exit full screen.
