Guest User

Untitled

a guest
Jul 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. (defn quoted-string [ch]
  2. (let [quoteSeparator (is-char ch)
  3. stringBody (stringify (many1 (either (not-char-of #{ch \# \newline}) (not-followed-by (string "#") (string "{")))))
  4. expressionBody (let-bind [_ (string "#{")
  5. expr (stringify (many1 (not-char \})))
  6. _ (string "}")]
  7. (result (read-string expr)))
  8. expansionBody (many (either stringBody expressionBody))
  9. optimize (fn [exp] (if (== 2 (count exp)) (second exp) exp))]
  10. (>>== (between quoteSeparator quoteSeparator expansionBody) #(optimize (apply list 'str %)))))
Add Comment
Please, Sign In to add comment