Created
January 20, 2017 16:33
-
-
Save hyotang666/06f2a51df45433570a3abe3fcc4ec592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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