-
-
Save mmower/c2fe70504df903ac2538 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 randomly | |
[& exprs] | |
`(eval (rand-nth (quote ~exprs)))) | |
(defmacro randomly [& exprs] | |
(let [len (count exprs) | |
index (rand-int len) | |
conditions (map #(list '= index %) (range len))] | |
`(cond ~@(interleave conditions exprs)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment