function | since v0.0-927 | clojure.core/repeatedly | Edit |
(repeatedly f)
(repeatedly n f)
Takes a function f
of no args, presumably with side effects, and returns an
infinite (or length n
if supplied) lazy sequence of calls to it.
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
(defn repeatedly
([f] (lazy-seq (cons (f) (repeatedly f))))
([n f] (take n (repeatedly f))))