summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-08-29 10:50:08 -0400
committerRich Hickey <richhickey@gmail.com>2009-08-29 10:50:08 -0400
commit646aa1260bbc82472f64d2867a3ec961c8b678b2 (patch)
tree2d6812843eb1ca764318ee77da3562b9b8b0c196 /src
parenta2f8dcd6bd9c2ed9e50bd473ec9a3d9b4f7428de (diff)
added arity overloads to list*
Diffstat (limited to 'src')
-rw-r--r--src/clj/clojure/core.clj14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index 587e0953..da57823d 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -395,6 +395,15 @@
(nil? (next arglist)) (seq (first arglist))
:else (cons (first arglist) (spread (next arglist)))))
+(defn list*
+ "Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
+ ([args] args)
+ ([a args] (cons a args))
+ ([a b args] (cons a (cons b args)))
+ ([a b c args] (cons a (cons b (cons c args))))
+ ([a b c d & more]
+ (cons a (cons b (cons c (cons d (spread more)))))))
+
(defn apply
"Applies fn f to the argument list formed by prepending args to argseq."
{:arglists '([f args* argseq])}
@@ -407,10 +416,7 @@
[obj f & args]
(with-meta obj (apply f (meta obj) args)))
-(defn list*
- "Creates a new list containing the item prepended to more."
- [item & more]
- (spread (cons item more)))
+
(defmacro lazy-seq
"Takes a body of expressions that returns an ISeq or nil, and yields