(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\n returns an infinite (or length n if supplied) lazy sequence of calls\n to it"
([f] (lazy-seq (cons (f) (repeatedly f))))
([n f] (take n (repeatedly f))))