Elisp: Destructure Binding
seq-setq
-
bind a
Sequence
of values to several variables.
- If there are more values, they are ignored.
- If there are more variables, they get nil.
(let (x1 x2) (seq-setq (x1 x2) [3 4]) (message "%s %s" x1 x2)) ;; 3 4 (let (x1 x2) (seq-setq (x1 x2) (list 3 4)) (message "%s %s" x1 x2)) ;; 3 4
seq-let
-
bind a
Sequence
of values to several local variables.
- If there more values, they are ignored.
- If there more variables, they get nil.
;; example of using seq-let ;; if there are more variables than in sequence, the rest has value of nil (seq-let (xa xb xc) [1 2] (vector xa xb xc)) ;; [1 2 nil] ;; if there are less variables than in sequence, the rest sequence is ignored (seq-let (xa xb) [1 2 3 4 5] (vector xa xb)) ;; [1 2]
Elisp, Variable
Elisp, sequence functions
- Elisp: Sequence Type
- Elisp: Sequence Functions
- Elisp: Sequence, Take, Drop, Slice
- Elisp: Map to Sequence
- Elisp: Foreach (Side-Effect)
- Elisp: Sequence Iteration, Conditional Exit
- Elisp: Sequence Filter
- Elisp: Sequence Map Insert
- Elisp: Sequence Iteration
- Elisp: Sequence Find
- Elisp: Sequence, Sort, Reverse
- Elisp: Sequence Join, Convert
- Elisp: Sequence Union, Intersection, Difference
- Elisp: More Sequence Functions
- Elisp: Destructure Binding