-
-
Save Gonzih/4436070 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
"Flips a functions argument list." | |
[f] (fn [& args] (apply f (reverse args)))) | |
;Slightly shorter implementation by Anthony Grimes @IORayne | |
(defn flip [f] #(apply f (reverse %&))) | |
(def my-gt (flip >)) | |
(> 10 9); => true | |
(my-gt 10 9); => false | |
(def my-after? (flip after?)) | |
(after? (date-time 1986 10) (date-time 1986 9)); => true | |
(my-after? (date-time 1986 10) (date-time 1986 9)); => false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment