Skip to content

Instantly share code, notes, and snippets.

@gabbigum
Created April 2, 2020 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabbigum/e033175ed4773a03156b240fddd4fa26 to your computer and use it in GitHub Desktop.
Save gabbigum/e033175ed4773a03156b240fddd4fa26 to your computer and use it in GitHub Desktop.
(defmacro report
[to-try]
`(if ~to-try
(println (quote ~to-try) "was successful:" ~to-try)
(println (quote ~to-try) "was not successful:" ~to-try)))
;; Thread/sleep takes a number of milliseconds to sleep for
(report (do (Thread/sleep 1000) (+ 1 1)))
produces that
(if (do (Thread/sleep 1000) (+ 1 1))
(println '(do (Thread/sleep 1000) (+ 1 1))
"was successful:"
(do (Thread/sleep 1000) (+ 1 1)))
(println '(do (Thread/sleep 1000) (+ 1 1))
"was not successful:"
(do (Thread/sleep 1000) (+ 1 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment