Created
September 10, 2014 17:43
-
-
Save timmc/68ca16d306ee264b409e 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 <-?-> | |
[& forms] | |
(let [forms (shuffle forms)] | |
(reduce (fn [a f] | |
(let [f (if (seq? f) f (list f)) | |
i (rand-int (inc (count f)))] | |
(concat (take i f) [a] (drop i f)))) | |
(first forms) | |
(rest forms)))) | |
adhoc.core=> (macroexpand-1 '(<-?-> 5 inc list count)) | |
((inc (count list)) 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment