Function: seq--make-pcase-bindings

seq--make-pcase-bindings is a byte-compiled function defined in seq.el.gz.

Signature

(seq--make-pcase-bindings ARGS)

Documentation

Return list of bindings of the variables in ARGS to the elements of a sequence.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/seq.el.gz
(defun seq--make-pcase-bindings (args)
  "Return list of bindings of the variables in ARGS to the elements of a sequence."
  (let ((bindings '())
        (index 0)
        (rest-marker nil))
    (seq-doseq (name args)
      (unless rest-marker
        (pcase name
          (`&rest
           (progn (push `(app (seq-drop _ ,index)
                              ,(seq--elt-safe args (1+ index)))
                        bindings)
                  (setq rest-marker t)))
          (_
           (push `(app (seq--elt-safe _ ,index) ,name) bindings))))
      (setq index (1+ index)))
    bindings))