-
-
Save amalloy/70f5bf52417ccdef5938 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
(let [reorder (fn [f order] | |
(fn [& args] | |
(let [argv (vec args) | |
new-args (reduce (fn [args [old new]] | |
(assoc args new (argv old))) | |
argv | |
order)] | |
(apply f new-args))))] | |
((reorder map {0 1, 1 0}) [1 2] inc)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment