Browse files

expose backing fn for `code` macro

  • Loading branch information...
1 parent e8282c7 commit a22aaeec88ed560a728eb7126650a59fcabf8265 @cemerick cemerick committed Jan 27, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/main/clojure/clojure/tools/nrepl.clj
8 src/main/clojure/clojure/tools/nrepl.clj
@@ -134,14 +134,20 @@
(assoc m k v))))
{} (apply concat responses)))
+(defn code*
+ "Returns a single string containing the pr-str'd representations
+ of the given expressions."
+ [& expressions]
+ (apply str (map pr-str expressions)))
(defmacro code
"Expands into a string consisting of the macro's body's forms
(literally, no interpolation/quasiquoting of locals or other
references), suitable for use in an :eval message, e.g.:
{:op :eval, :code (code (+ 1 1) (slurp \"foo.txt\"))}"
[& body]
- (apply str (map pr-str body)))
+ (apply code* body))
(defn read-response-value
"Returns the provided response message, replacing its :value string with

0 comments on commit a22aaee

Please sign in to comment.