Function: -iteratefn

-iteratefn is a byte-compiled function defined in dash.el.

Signature

(-iteratefn FN N)

Documentation

Return a function FN composed N times with itself.

FN is a unary function. If you need to use a function of higher arity, use -applify first to turn it into a unary function.

With n = 0, this acts as identity function.

In types: (a -> a) -> Int -> a -> a.

This function satisfies the following law:

  (funcall (-iteratefn fn n) init) = (-last-item (-iterate fn init (1+ n))).

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -iteratefn (fn n)
  "Return a function FN composed N times with itself.

FN is a unary function.  If you need to use a function of higher
arity, use `-applify' first to turn it into a unary function.

With n = 0, this acts as identity function.

In types: (a -> a) -> Int -> a -> a.

This function satisfies the following law:

  (funcall (-iteratefn fn n) init) = (-last-item (-iterate fn init (1+ n)))."
  (declare (pure t) (side-effect-free error-free))
  (lambda (x) (--dotimes n (setq x (funcall fn x))) x))