Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clojure: how to evaluate a quoted form in the local scope?
- (equal-chance
- (println "1")
- (println "2"))
- (defmacro equal-chance
- [& exprs]
- `(rand-nth '~exprs))
- (let [x 10] (eval '(println x)))
- (defmacro equal-chance [& exprs]
- `((rand-nth [~@(map (fn [e] `(fn [] ~e)) exprs)])))
- (defmacro equal-chance
- [& exprs]
- (rand-nth exprs))
Add Comment
Please, Sign In to add comment