Skip to content

Instantly share code, notes, and snippets.

@rplevy
Created April 24, 2012 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplevy/2481715 to your computer and use it in GitHub Desktop.
Save rplevy/2481715 to your computer and use it in GitHub Desktop.
string that can contain quotes (for reader-valid content only)
(defmacro qq [& body]
`(->>
(map (fn [s#]
(if (string? s#)
(format "\"%s\"" s#) (str s#)))
(quote ~body))
(interpose " ")
(apply str)))
(defn myfn "docstring \"the normal way\" sort of a pain" [] )
(defn ^{:doc (qq this docstring is "a little better")} myfn2 [] )
;; and you can interpolate values
(qq this string is #=(+ 1 1) times "better")
@rplevy-draker
Copy link

But it could be explicitly supported similar to Chas's macro...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment