Skip to content

Instantly share code, notes, and snippets.

@devn devn/gist:765778
Created Jan 5, 2011

Embed
What would you like to do?
(defn quoted-string [ch]
(let [quoteSeparator (is-char ch)
stringBody (stringify (many1 (either (not-char-of #{ch \# \newline}) (not-followed-by (string "#") (string "{")))))
expressionBody (let-bind [_ (string "#{")
expr (stringify (many1 (not-char \})))
_ (string "}")]
(result (read-string expr)))
expansionBody (many (either stringBody expressionBody))
optimize (fn [exp] (if (== 2 (count exp)) (second exp) exp))]
(>>== (between quoteSeparator quoteSeparator expansionBody) #(optimize (apply list 'str %)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.