Function: seq-doseq
seq-doseq is a macro defined in seq.el.gz.
Signature
(seq-doseq (VAR SEQUENCE) BODY...)
Documentation
Loop over a SEQUENCE, evaluating BODY with VAR bound to each of its elements.
Similar to dolist but can be applied to lists, strings, and vectors.
Other relevant functions are documented in the sequence group.
Shortdoc
;; sequence
(seq-doseq (a '("foo" "bar")) (insert a))
e.g. => ("foo" "bar")
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/seq.el.gz
;; We used to use some sequence functions from cl-lib, but this
;; dependency was swapped around so that it's easier to make seq.el
;; preloaded. See also Bug#39761#26.
(defmacro seq-doseq (spec &rest body)
"Loop over a SEQUENCE, evaluating BODY with VAR bound to each of its elements.
Similar to `dolist' but can be applied to lists, strings, and vectors.
\(fn (VAR SEQUENCE) BODY...)"
(declare (indent 1) (debug ((symbolp form &optional form) body)))
`(seq-do (lambda (,(car spec))
,@body)
,(cadr spec)))