Function: clojure--pattern-declarations

clojure--pattern-declarations is a byte-compiled function defined in clojure-mode.el.

Signature

(clojure--pattern-declarations PATTERN)

Documentation

Return the forms of the names PATTERN binds, and of its :or keys.

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20261103.1226/clojure-mode.el
(defun clojure--pattern-declarations (pattern)
  "Return the forms of the names PATTERN binds, and of its :or keys."
  (pcase pattern
    (`(sym ,form) (list form))
    (`(vec ,_ . ,patterns) (mapcan #'clojure--pattern-declarations patterns))
    (`(map ,_ . ,units)
     (mapcan (lambda (unit)
               (pcase unit
                 (`(keys ,_ ,_ ,elems) (mapcar #'cdr (seq-filter #'car elems)))
                 (`(as ,_ ,sym ,_) (list sym))
                 (`(or ,_ ,_ ,entries) (mapcar #'cadr entries))
                 (`(pair ,key ,_ ,_) (list key))
                 (`(nested ,_ ,_ ,sub) (clojure--pattern-declarations sub))))
             units))))