Skip to content

Instantly share code, notes, and snippets.

@cark
Created September 12, 2012 21:14
Show Gist options
  • Save cark/3709981 to your computer and use it in GitHub Desktop.
Save cark/3709981 to your computer and use it in GitHub Desktop.
one of two things
user> (defmacro as-doubled-pair [v]
`(let [v# (mapv (partial * 2) ~v)]
[v# v#]))
#'user/as-doubled-pair
user> (macroexpand (as-doubled-pair [1 2 3]))
[[2 4 6] [2 4 6]]
user> (defmacro as-doubled-pair2 [v]
(let [v (mapv (partial * 2) v)]
`(do [~v ~v])))
#'user/as-doubled-pair2
user> (macroexpand (as-doubled-pair2 [1 2 3]))
[[2 4 6] [2 4 6]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment