diff options
-rw-r--r-- | src/clj/clojure/core.clj | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index b3b01ba8..bec3f2af 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -3593,9 +3593,11 @@ (if ((mk-bound-fn sc end-test end-key) e) s (next s)))))) (defn repeatedly - "Takes a function of no args, presumably with side effects, and returns an infinite - lazy sequence of calls to it" - [f] (lazy-seq (cons (f) (repeatedly f)))) + "Takes a function of no args, presumably with side effects, and + returns an infinite (or length n if supplied) lazy sequence of calls + to it" + ([f] (lazy-seq (cons (f) (repeatedly f)))) + ([n f] (take n (repeatedly f)))) (defn add-classpath "DEPRECATED |