Elisp: List Iteration
dolist
dolist
-
(dolist (VAR LIST) BODY)
(dolist (VAR LIST RESULT) BODY)
- Loop over a List.
- Each time eval BODY, with VAR having value of an element in list.
- Return nil or RESULT.
- RESULT is evaluated last.
💡 TIP: for sequence, use
seq-doseq
. 〔see Elisp: Sequence Iteration〕(let (xx) (setq xx (number-sequence 1 5)) (dolist (n xx) (insert (number-to-string n)))) ;; inserts 12345 ;; return nil