Function: seq-take-while

seq-take-while is a byte-compiled function defined in seq.el.gz.

Signature

(seq-take-while PRED SEQUENCE)

Documentation

Take the successive elements of SEQUENCE for which PRED returns non-nil.

PRED is a function of one argument. The function keeps collecting elements from SEQUENCE and adding them to the result until PRED returns nil for an element. Value is a sequence of the same type as SEQUENCE.

Other relevant functions are documented in the sequence group.

View in manual

Shortdoc

;; sequence
(seq-take-while #'integerp [1 2 3.0 4])
    => [1 2]

Implementations

(seq-take-while PRED SEQUENCE) in `seq.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/seq.el.gz
(cl-defgeneric seq-take-while (pred sequence)
  "Take the successive elements of SEQUENCE for which PRED returns non-nil.
PRED is a function of one argument.  The function keeps collecting
elements from SEQUENCE and adding them to the result until PRED
returns nil for an element.
Value is a sequence of the same type as SEQUENCE."
  (seq-take sequence (seq--count-successive pred sequence)))