Skip to content

Instantly share code, notes, and snippets.

@hyotang666
Created January 20, 2017 16:33
Show Gist options
  • Save hyotang666/06f2a51df45433570a3abe3fcc4ec592 to your computer and use it in GitHub Desktop.
Save hyotang666/06f2a51df45433570a3abe3fcc4ec592 to your computer and use it in GitHub Desktop.
(defmacro with-random-var((var num)&body body)
(let((gvar(gensym "VAR")))
`(LET((,gvar ,num))
(SYMBOL-MACROLET((,var (RANDOM ,gvar)))
,@body))))
#+usage
(with-random-var(symbol 100)
(+ symbol symbol))
; => (+ (random 100)(random 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment