Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active May 7, 2017 09:45
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 deque-blog/c6dc4a447d52a36e5b78dc48ec522e25 to your computer and use it in GitHub Desktop.
Save deque-blog/c6dc4a447d52a36e5b78dc48ec522e25 to your computer and use it in GitHub Desktop.
(defmacro add-m
[a b]
`(constexpr add ~a ~b))
(def ^:const x 1)
(def ^:const y 2)
;; Summing two global variables at compile time
(walk/macroexpand-all '(add-m x y))
=> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment