Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created March 2, 2011 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/70f5bf52417ccdef5938 to your computer and use it in GitHub Desktop.
Save amalloy/70f5bf52417ccdef5938 to your computer and use it in GitHub Desktop.
(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