Created
November 1, 2012 01:14
-
-
Save jasonjohnson/3990998 to your computer and use it in GitHub Desktop.
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
; I have a bunch of these "example"-type functions: | |
(defn example [a b c] (str a b c)) | |
; Imagine incoming calls which look like this: | |
(def testing '(example 2 3)) | |
; My naive first attempt. Prints the string "123" | |
(println (apply (partial (resolve (first testing)) 1) (rest testing))) | |
; So, I've pre-applied the first argument to the function! | |
; What I'm looking for would look like this: | |
(with-account account | |
(do-first-thing arg2 arg3) | |
(do-second-thing arg2 arg3) | |
(do-third-thing arg2 arg3)) | |
; Which would expand to: | |
(do-first-thing account arg2 arg3) | |
(do-second-thing account arg2 arg3) | |
(do-third-thing account arg2 arg3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment