Created
March 11, 2014 23:39
-
-
Save fredrick/9497459 to your computer and use it in GitHub Desktop.
Thread last currying
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
;; | |
;; Example of thread last macro ->> and partial function application | |
;; | |
(defn header [this] {:head this}) | |
(->> (header 1) :head ((partial + 1))) | |
;; => 2 | |
(->> (header 3) :head ((partial - 1))) | |
;; => -2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment