Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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 %)))))
Add Comment
Please, Sign In to add comment