Skip to content

Instantly share code, notes, and snippets.

@whacked
Created April 29, 2016 15:02
Show Gist options
  • Save whacked/24dba56e0844a7f37a72fcb7a9409527 to your computer and use it in GitHub Desktop.
Save whacked/24dba56e0844a7f37a72fcb7a9409527 to your computer and use it in GitHub Desktop.
example sibilant macro to turn console.log calls into comments at compile time
(var DEBUG-LEVEL 10
console-log-orig console.log)
(assign console.log
(#(...argv)
(when (< 0 DEBUG-LEVEL)
(console-log-orig.apply console argv))))
;; comment this out to preserve console.log in js output
(macro console.log (...body) `(comment ...@body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment