(repeatedly f)
(repeatedly n 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
Source
(defn repeatedly
"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"
{:added "1.0"
:static true}
([f] (lazy-seq (cons (f) (repeatedly f))))
([n f] (take n (repeatedly f))))