Function: --each-while
--each-while is a macro defined in dash.el.
Signature
(--each-while LIST PRED &rest BODY)
Documentation
Evaluate BODY for each item in LIST, while PRED evaluates to non-nil.
Each element of LIST in turn 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-while.
Source Code
;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --each-while (list pred &rest body)
"Evaluate BODY for each item in LIST, while PRED evaluates to non-nil.
Each element of LIST in turn 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-while'."
(declare (debug (form form body)) (indent 2))
(let ((l (make-symbol "list"))
(i (make-symbol "i"))
(elt (make-symbol "elt")))
`(let ((,l ,list)
(,i 0)
,elt)
(while (when ,l
(setq ,elt (car-safe ,l))
(let ((it ,elt) (it-index ,i))
(ignore it it-index)
,pred))
(let ((it ,elt) (it-index ,i))
(ignore it it-index)
,@body)
(setq ,i (1+ ,i) ,l (cdr ,l))))))