-
-
Save alandipert/64a598b9e26eb0a0ac96 to your computer and use it in GitHub Desktop.
Revisions
-
alandipert renamed this gist
Nov 11, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alandipert renamed this gist
Nov 11, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
alandipert revised this gist
Nov 11, 2014 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,11 +5,15 @@ (if (seq tokens) (let [token (first tokens)] (cond (string? token) (recur (rest tokens) (doto out-str (.append token)) out-args) (vector? token) (recur (rest tokens) (doto out-str (.append (str/join "," (map (constantly "?") token)))) (into out-args token)) :else (recur (rest tokens) (doto out-str (.append "?")) (conj out-args token)))) (into [(str out-str)] out-args)))) -
alandipert created this gist
Nov 11, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ (defn deterpolate [s] (loop [tokens (interpolate s) out-str (StringBuffer.) out-args []] (if (seq tokens) (let [token (first tokens)] (cond (string? token) (recur (rest tokens) (doto out-str (.append token)) out-args) (or (vector? token) (list? token) (seq? token)) (recur (rest tokens) (doto out-str (.append (str/join "," (map (constantly "?") token)))) (into out-args token)) :else (recur (rest tokens) (doto out-str (.append "?")) (conj out-args token)))) (into [(str out-str)] out-args))))