diff --git a/src/rss_thread_watch/utils.clj b/src/rss_thread_watch/utils.clj index 492677f..fa95d4f 100644 --- a/src/rss_thread_watch/utils.clj +++ b/src/rss_thread_watch/utils.clj @@ -27,6 +27,17 @@ res# ~else))) +;; Todo: Test this properly and if working, replace when-else with this +;; Todo: find a way to download clojure documentation for offline use +(defmacro when-else2 + "Evaluates [tst], if it's truthy value returns that value. + If it's not, execute everything in [else] and return last expr." + [tst & else] + `(let [res# ~tst] + (if res# + res# + (do ~@else)))) + (defmacro ret= "compares two values using [=]. If the result is true returns the value, else the result of [=].