Function: erc--doarray

erc--doarray is a macro defined in erc-common.el.gz.

Signature

(erc--doarray (VAR ARRAY [RESULT]) BODY...)

Documentation

Map over ARRAY, running BODY with VAR bound to iteration element.

Behave more or less like seq-doseq, but tailor operations for arrays.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-common.el.gz
(defmacro erc--doarray (spec &rest body)
  "Map over ARRAY, running BODY with VAR bound to iteration element.
Behave more or less like `seq-doseq', but tailor operations for
arrays.

\(fn (VAR ARRAY [RESULT]) BODY...)"
  (declare (indent 1) (debug ((symbolp form &optional form) body)))
  (let ((array (make-symbol "array"))
        (len (make-symbol "len"))
        (i (make-symbol "i")))
    `(let* ((,array ,(nth 1 spec))
            (,len (length ,array))
            (,i 0))
       (while-let (((< ,i ,len))
                   (,(car spec) (aref ,array ,i)))
         ,@body
         (cl-incf ,i))
       ,(nth 2 spec))))