Function: drop-while
drop-while is a byte-compiled function defined in subr.el.gz.
Signature
(drop-while PRED LIST)
Documentation
Skip initial elements of LIST satisfying PRED and return the rest.
Other relevant functions are documented in the list group.
Probably introduced at or before Emacs version 31.1.
Shortdoc
;; list
(drop-while #'numberp '(1 2 three 4 five))
=> (three 4 five)
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun drop-while (pred list)
"Skip initial elements of LIST satisfying PRED and return the rest."
(declare (compiler-macro
(lambda (_form)
(let* ((tail (make-symbol "tail"))
(pred (macroexpand-all pred macroexpand-all-environment))
(f (and (not (internal--effect-free-fun-arg-p pred))
(make-symbol "f"))))
`(let (,@(and f `((,f ,pred)))
(,tail ,list))
(while (and ,tail (funcall ,(or f pred) (car ,tail)))
(setq ,tail (cdr ,tail)))
,tail)))))
(while (and list (funcall pred (car list)))
(setq list (cdr list)))
list)