diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-01-03 15:13:01 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-01-03 15:13:01 +0000 |
commit | 3d14de92f6d7ce58b9f56f9e6112ddb8c5721a38 (patch) | |
tree | 7b28911d4e228d4431a32f65fd6ee8f91da69a95 /src | |
parent | 9576e7b2edf541f63dc8592d3cf629dfe21a06f5 (diff) |
made strcat accept 0 args, switched to StringBuilder in implementation. Made pr et al accept 0 args
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/boot.clj b/src/boot.clj index f9e8f7d3..c1df6230 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -80,11 +80,14 @@ (defn #^String str [#^Object x] (if x (. x (toString)) "")) -(defn #^String strcat [x & ys] - (let [#^String s (str x)] - (if ys - (recur (. s (concat (str (first ys)))) (rest ys)) - s))) +(defn #^String strcat + ([] "") + ([x] (str x)) + ([x & ys] + (loop [sb (new StringBuilder (str x)) more ys] + (if more + (recur (. sb (append (str (first more)))) (rest more)) + (str sb))))) (defn sym ([name] (. clojure.lang.Symbol (intern name))) @@ -742,6 +745,7 @@ fmap)))) (defn pr + ([] nil) ([x] (. clojure.lang.RT (print x *out*)) nil) |