Function: --each-r-while
--each-r-while is a macro defined in dash.el.
Signature
(--each-r-while LIST PRED &rest BODY)
Documentation
Eval BODY for each item in reversed LIST, while PRED evals to non-nil.
Each element of LIST in turn, starting at its end, is bound to
it and its index within LIST to it-index before evaluating
PRED or BODY. Once an element is reached for which PRED
evaluates to nil, no further BODY is evaluated. The return value
is always nil.
This is the anaphoric counterpart to -each-r-while.
Source Code
;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --each-r-while (list pred &rest body)
"Eval BODY for each item in reversed LIST, while PRED evals to non-nil.
Each element of LIST in turn, starting at its end, is bound to
`it' and its index within LIST to `it-index' before evaluating
PRED or BODY. Once an element is reached for which PRED
evaluates to nil, no further BODY is evaluated. The return value
is always nil.
This is the anaphoric counterpart to `-each-r-while'."
(declare (debug (form form body)) (indent 2))
(let ((v (make-symbol "vector"))
(i (make-symbol "i"))
(elt (make-symbol "elt")))
`(let* ((,v (vconcat ,list))
(,i (length ,v))
,elt it it-index)
(ignore it it-index)
(while (when (> ,i 0)
(setq ,i (1- ,i) it-index ,i)
(setq ,elt (aref ,v ,i) it ,elt)
,pred)
(setq it-index ,i it ,elt)
,@body))))