Function: --take-while

--take-while is a macro defined in dash.el.

Signature

(--take-while FORM LIST)

Documentation

Take successive items from LIST for which FORM evals to non-nil.

Each element of LIST in turn is bound to it and its index within LIST to it-index before evaluating FORM. Return a new list of the successive elements from the start of LIST for which FORM evaluates to non-nil. This is the anaphoric counterpart to -take-while.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --take-while (form list)
  "Take successive items from LIST for which FORM evals to non-nil.
Each element of LIST in turn is bound to `it' and its index
within LIST to `it-index' before evaluating FORM.  Return a new
list of the successive elements from the start of LIST for which
FORM evaluates to non-nil.
This is the anaphoric counterpart to `-take-while'."
  (declare (debug (form form)))
  (let ((r (make-symbol "result")))
    `(let (,r)
       (--each-while ,list ,form (push it ,r))
       (nreverse ,r))))