Skip to content

Instantly share code, notes, and snippets.

@kirasystems
Created June 15, 2012 05:15
Show Gist options
  • Save kirasystems/2934782 to your computer and use it in GitHub Desktop.
Save kirasystems/2934782 to your computer and use it in GitHub Desktop.
(defn str-template
[s & args]
(fn [params]
(apply format s ((apply juxt args) params))))
user=> (def t1 (str-template "My name is %s, my id is %s" :firstname :ssn))
#'user/t1
user=> (t1 {:firstname "John" :lastname "Doe" :ssn "111111" })
"My name is John, my id is 111111"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment