Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix (println 1 1) => "11\n" instead of "1 1\n"

  • Loading branch information...
commit 280ea95938883f97be82267d109342178a2e47aa 1 parent 0f2be41
Brandon Bloom authored June 21, 2012 David Nolen committed July 05, 2012
22  src/cljs/cljs/core.cljs
@@ -6146,11 +6146,11 @@ reduces them without incurring seq initialization"
6146 6146
              :else (list "#<" (str obj) ">")))))
6147 6147
 
6148 6148
 (defn- pr-sb [objs opts]
6149  
-  (let [first-obj (first objs)
6150  
-        sb (gstring/StringBuffer.)]
6151  
-    (doseq [obj objs]
6152  
-      (when-not (identical? obj first-obj)
6153  
-        (.append sb " "))
  6149
+  (let [sb (gstring/StringBuffer.)]
  6150
+    (doseq [string (pr-seq (first objs) opts)]
  6151
+      (.append sb string))
  6152
+    (doseq [obj (next objs)]
  6153
+      (.append sb " ")
6154 6154
       (doseq [string (pr-seq obj opts)]
6155 6155
         (.append sb string)))
6156 6156
     sb))
@@ -6172,12 +6172,12 @@ reduces them without incurring seq initialization"
6172 6172
   "Prints a sequence of objects using string-print, observing all
6173 6173
   the options given in opts"
6174 6174
   [objs opts]
6175  
-  (let [first-obj (first objs)]
6176  
-    (doseq [obj objs]
6177  
-      (when-not (identical? obj first-obj)
6178  
-        (string-print " "))
6179  
-      (doseq [string (pr-seq obj opts)]
6180  
-        (string-print string)))))
  6175
+  (doseq [string (pr-seq (first objs) opts)]
  6176
+    (string-print string))
  6177
+  (doseq [obj (next objs)]
  6178
+    (string-print " ")
  6179
+    (doseq [string (pr-seq obj opts)]
  6180
+      (string-print string))))
6181 6181
 
6182 6182
 (defn newline [opts]
6183 6183
   (string-print "\n")
2  test/cljs/cljs/core_test.cljs
@@ -221,7 +221,7 @@
221 221
   (assert (= (hash-map :foo 5)
222 222
              (assoc (cljs.core.ObjMap. nil (array) (js-obj)) :foo 5)))
223 223
 
224  
-  (assert (= "\"asdf\"" (pr-str "asdf")))
  224
+  (assert (= "\"asdf\" \"asdf\"" (pr-str "asdf" "asdf")))
225 225
   (assert (= "[1 true {:a 2, :b #\"x\\\"y\"} #<Array [3, 4]>]"
226 226
              (pr-str [1 true {:a 2 :b #"x\"y"} (array 3 4)])))
227 227
 

0 notes on commit 280ea95

Please sign in to comment.
Something went wrong with that request. Please try again.