Skip to content

Instantly share code, notes, and snippets.

@jebberjeb
Created August 14, 2013 04:34
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 jebberjeb/6228036 to your computer and use it in GitHub Desktop.
Save jebberjeb/6228036 to your computer and use it in GitHub Desktop.
Reverse a functions argument order.
(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"
@err
Copy link

err commented Aug 14, 2013

+9000

@jebberjeb
Copy link
Author

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