Function: --partition-after-pred

--partition-after-pred is a macro defined in dash.el.

Signature

(--partition-after-pred FORM LIST)

Documentation

Partition LIST after each element for which FORM evaluates to non-nil.

Each element of LIST in turn is bound to it before evaluating FORM.

This is the anaphoric counterpart to -partition-after-pred.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --partition-after-pred (form list)
  "Partition LIST after each element for which FORM evaluates to non-nil.
Each element of LIST in turn is bound to `it' before evaluating
FORM.

This is the anaphoric counterpart to `-partition-after-pred'."
  (let ((l (make-symbol "list"))
        (r (make-symbol "result"))
        (s (make-symbol "sublist")))
    `(let ((,l ,list) ,r ,s)
       (when ,l
         (--each ,l
           (push it ,s)
           (when ,form
             (push (nreverse ,s) ,r)
             (setq ,s ())))
         (when ,s
           (push (nreverse ,s) ,r))
         (nreverse ,r)))))