Created
August 14, 2013 04:34
-
-
Save jebberjeb/6228036 to your computer and use it in GitHub Desktop.
Reverse a functions argument order.
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
(defn flip [f] | |
"Create a function of f, with the argument order reversed" | |
(fn [& args] | |
(apply f (reverse args)))) | |
((flip get-in) [:foo :bar] {:foo {:bar "foo bar"}}) | |
;=> "foo bar" |
Aight, I'm gonna add it then ... going once ... going twice ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+9000