Function: -counter
-counter is a byte-compiled function defined in dash.el.
Signature
(-counter &optional BEG END INC)
Documentation
Return a closure that counts from BEG to END, with increment INC.
The closure will return the next value in the counting sequence each time it is called, and nil after END is reached. BEG defaults to 0, INC defaults to 1, and if END is nil, the counter will increment indefinitely.
The closure accepts any number of arguments, which are discarded.
Source Code
;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -counter (&optional beg end inc)
"Return a closure that counts from BEG to END, with increment INC.
The closure will return the next value in the counting sequence
each time it is called, and nil after END is reached. BEG
defaults to 0, INC defaults to 1, and if END is nil, the counter
will increment indefinitely.
The closure accepts any number of arguments, which are discarded."
(declare (pure t) (side-effect-free error-free))
(let ((inc (or inc 1))
(n (or beg 0)))
(lambda (&rest _)
(when (or (not end) (< n end))
(prog1 n
(setq n (+ n inc)))))))